On 26.07.24 11:43, Ryan Roberts wrote:
On 26/07/2024 09:28, Barry Song wrote:
From: Barry Song <v-songbaohua@xxxxxxxx>
khugepaged will be automatically started when PMD-sized THP is enabled
(either of the per-size anon control or the top-level control are set
to "always" or "madvise"), and it'll be automatically shutdown when
PMD-sized THP is disabled (when both the per-size anon control and the
top-level control are "never").
It seems unnecessary to call start_stop_khugepaged() for non-PMD THP,
as it would only waste CPU time.
Cc: Lance Yang <ioworker0@xxxxxxxxx>
Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
Cc: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: Yang Shi <shy828301@xxxxxxxxx>
Cc: Zi Yan <ziy@xxxxxxxxxx>
Signed-off-by: Barry Song <v-songbaohua@xxxxxxxx>
---
mm/huge_memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 41460847988c..bd365e35acf7 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -514,7 +514,7 @@ static ssize_t thpsize_enabled_store(struct kobject *kobj,
} else
ret = -EINVAL;
- if (ret > 0) {
+ if (ret > 0 && order == HPAGE_PMD_ORDER) {
int err;
err = start_stop_khugepaged();
Personally I see this as a bit of a layering violation; its
start_stop_khugepaged() that should decide the policy for when to start and stop
the daemon. thpsize_enabled_store() should just be calling
start_stop_khugepaged() to notify that something potentially pertinent to the a
policy decision has changed.
Agreed, skimming the subject I was under the impression that we would be
fixing something here.
--
Cheers,
David / dhildenb