-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support THP in tiup cluster check #964
Conversation
Codecov Report
@@ Coverage Diff @@
## master #964 +/- ##
==========================================
- Coverage 55.44% 51.61% -3.83%
==========================================
Files 263 263
Lines 19833 19854 +21
==========================================
- Hits 10996 10248 -748
- Misses 7118 7972 +854
+ Partials 1719 1634 -85
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
pkg/cluster/operation/check.go
Outdated
@@ -58,6 +58,7 @@ var ( | |||
CheckNameSELinux = "selinux" | |||
CheckNameCommand = "command" | |||
CheckNameFio = "fio" | |||
CheckNameTHP = "THP" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep up with the previous code style, use lowercase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, got it
pkg/cluster/task/check.go
Outdated
@@ -33,6 +33,7 @@ var ( | |||
CheckTypePackage = "package" | |||
CheckTypePartitions = "partitions" | |||
CheckTypeFIO = "fio" | |||
CheckTypeTHP = "THP" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, THP should be part of CheckTypeSystemConfig
pkg/cluster/operation/check.go
Outdated
@@ -651,3 +652,20 @@ func CheckFIOResult(rr, rw, lat []byte) []*CheckResult { | |||
|
|||
return results | |||
} | |||
|
|||
// CheckTHPEnabled checks THP in /sys/kernel/mm/transparent_hugepage/enabled,/sys/kernel/mm/transparent_hugepage/defrag | |||
func CheckTHPEnabled(opt *CheckOptions, l []byte) []*CheckResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/CheckTHPEnabled/CheckTHP/
var results []*CheckResult | ||
|
||
for _, line := range strings.Split(string(l), "\n") { | ||
if !strings.Contains(line, "[never]") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, if THP is disabled, we should also add a Msg
result
@@ -31,6 +31,7 @@ function cmd_subtest() { | |||
echo $check_result | grep "os-version" | |||
echo $check_result | grep "selinux" | |||
echo $check_result | grep "service" | |||
echo $check_result | grep "THP" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
components/cluster/command/check.go
Outdated
). | ||
Shell( | ||
inst.GetHost(), | ||
"cat /sys/kernel/mm/transparent_hugepage/defrag", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Maybe you can merge the two command into one:
cat /sys/kernel/mm/transparent_hugepage/{enabled,defrag}
- IMO, maybe you can implement the THP Check like
CheckSELinux()
@@ -442,6 +442,11 @@ func fixFailedChecks(ctx *task.Context, host string, res *operator.CheckResult, | |||
), | |||
true) | |||
msg = fmt.Sprintf("will try to %s, reboot might be needed", color.HiBlueString("disable SELinux")) | |||
case operator.CheckNameTHP: | |||
t.Shell(host, | |||
"echo never > /sys/kernel/mm/transparent_hugepage/enabled && echo never > /sys/kernel/mm/transparent_hugepage/defrag", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will disable THP in runtime, if the system rebooted, the THP's status maybe enabled again? Should we disable it permanently?
- Need to permanently disabled: seems need to change the
grub.cfg
, but this file maybe differ in different Linux System; - Don't need to: we should tell the user this fix is available until reboot
I perfer to the latter one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the origin issue is reference to tidb-ansible, maybe just keep the same behavior as tidb-ansible is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this config does not have an entry in sysctl
, so the only way to make it consist after reboot would be adding a kernel parameter at boot. ref https://www.kernel.org/doc/html/v5.4/admin-guide/mm/transhuge.html#boot-parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unpractical to add a kernel parameter, just remind the user to run tiup cluster check
again after reboot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/merge |
@lucklove: adding 'status/can-merge' to this PR must have 1 LGTMs In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/ti-community-prow repository. |
/lgtm |
/merge |
Can merge label has been added. Git tree hash: 9725709
|
@anywhy: Your PR has out-of-dated and I have automatically updated it for you. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the tidb-community-bots/ti-community-prow repository. |
Introduced by pingcap#964 There is a newline at the end of output of cat command, so the '[never]' check will fail on the empty newline.
Introduced by #964 There is a newline at the end of output of cat command, so the '[never]' check will fail on the empty newline.
Introduced by #964 There is a newline at the end of output of cat command, so the '[never]' check will fail on the empty newline.
What problem does this PR solve?
try implement #798
What is changed and how it works?
Check List
Tests
Release notes: