From 7345305f77add6e05a861030e1c4877b6b4f156d Mon Sep 17 00:00:00 2001 From: nexustar Date: Tue, 9 Aug 2022 14:14:06 +0800 Subject: [PATCH] cluster: fix THP check --- pkg/cluster/manager/check.go | 2 +- pkg/cluster/operation/check.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cluster/manager/check.go b/pkg/cluster/manager/check.go index 35935ef28f..5a89574e93 100644 --- a/pkg/cluster/manager/check.go +++ b/pkg/cluster/manager/check.go @@ -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")) diff --git a/pkg/cluster/operation/check.go b/pkg/cluster/operation/check.go index 682238533b..8258c9364e 100644 --- a/pkg/cluster/operation/check.go +++ b/pkg/cluster/operation/check.go @@ -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)