Skip to content

Commit

Permalink
cluster: fix THP check
Browse files Browse the repository at this point in the history
  • Loading branch information
nexustar committed Aug 9, 2022
1 parent 7680611 commit 7345305
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/cluster/manager/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ func fixFailedChecks(host string, res *operator.CheckResult, t *task.Builder) (s
msg = fmt.Sprintf("will try to %s, reboot might be needed", color.HiBlueString("disable SELinux"))
case operator.CheckNameTHP:
t.Shell(host,
fmt.Sprintf(`if [ -d %[1]s ]; then echo never > %[1]s/defrag && echo never > %[1]s/enabled; fi`, "/sys/kernel/mm/transparent_hugepage"),
fmt.Sprintf(`if [ -d %[1]s ]; then echo never > %[1]s/enabled; fi`, "/sys/kernel/mm/transparent_hugepage"),
"",
true)
msg = fmt.Sprintf("will try to %s, please check again after reboot", color.HiBlueString("disable THP"))
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/operation/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,14 +820,14 @@ func CheckFIOResult(rr, rw, lat []byte) []*CheckResult {
return results
}

// CheckTHP checks THP in /sys/kernel/mm/transparent_hugepage/{enabled,defrag}
// CheckTHP checks THP in /sys/kernel/mm/transparent_hugepage/enabled
func CheckTHP(ctx context.Context, e ctxt.Executor) *CheckResult {
result := &CheckResult{
Name: CheckNameTHP,
}

m := module.NewShellModule(module.ShellModuleConfig{
Command: fmt.Sprintf(`if [ -d %[1]s ]; then cat %[1]s/{enabled,defrag}; fi`, "/sys/kernel/mm/transparent_hugepage"),
Command: fmt.Sprintf(`if [ -d %[1]s ]; then cat %[1]s/enabled; fi`, "/sys/kernel/mm/transparent_hugepage"),
Sudo: true,
})
stdout, stderr, err := m.Execute(ctx, e)
Expand Down

0 comments on commit 7345305

Please sign in to comment.