From: "Kiryl Shutsemau (Meta)" <[email protected]>

The constant lives in collapse.h and is read by the limit helpers there,
so KHUGEPAGED_MAX_PTES_LIMIT names it after one of its callers rather
than after what it is.

Rename it to COLLAPSE_MAX_PTES_LIMIT, matching the other constant the
header defines.  khugepaged keeps using it to bound what its tunables
accept.

Assisted-by: Claude-Code:claude-opus-5
Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
---
 mm/collapse.c   | 8 ++++----
 mm/collapse.h   | 2 +-
 mm/khugepaged.c | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/mm/collapse.c b/mm/collapse.c
index 43a4b771bbe1..ae7c2777b279 100644
--- a/mm/collapse.c
+++ b/mm/collapse.c
@@ -193,19 +193,19 @@ unsigned int collapse_max_ptes_none(struct 
collapse_control *cc,
        if (is_pmd_order(order) || !cc->policy.strict_sub_pmd)
                return max_ptes_none;
        /*
-        * for mTHP collapse with the sysctl value set to 
KHUGEPAGED_MAX_PTES_LIMIT,
+        * for mTHP collapse with the sysctl value set to 
COLLAPSE_MAX_PTES_LIMIT,
         * scale the maximum number of PTEs to the order of the collapse.
         */
-       if (max_ptes_none == KHUGEPAGED_MAX_PTES_LIMIT)
+       if (max_ptes_none == COLLAPSE_MAX_PTES_LIMIT)
                return (1 << order) - 1;
        /*
-        * For mTHP collapse of values other than 0 or 
KHUGEPAGED_MAX_PTES_LIMIT,
+        * For mTHP collapse of values other than 0 or COLLAPSE_MAX_PTES_LIMIT,
         * emit a warning and return 0.
         */
        if (max_ptes_none)
                pr_warn_once("mTHP collapse does not support max_ptes_none"
                     " values other than 0 or %u, defaulting to 0.\n",
-                    KHUGEPAGED_MAX_PTES_LIMIT);
+                    COLLAPSE_MAX_PTES_LIMIT);
        return 0;
 }
 
diff --git a/mm/collapse.h b/mm/collapse.h
index 2fdb6418653a..94c11051f06a 100644
--- a/mm/collapse.h
+++ b/mm/collapse.h
@@ -8,7 +8,7 @@
 #include <linux/types.h>
 
 /* Ceiling the max_ptes_* tunables accept, and the value meaning "no limit" */
-#define KHUGEPAGED_MAX_PTES_LIMIT      (HPAGE_PMD_NR - 1)
+#define COLLAPSE_MAX_PTES_LIMIT                (HPAGE_PMD_NR - 1)
 
 /* The smallest order a collapse will build, and so the finest window it cuts 
*/
 #define COLLAPSE_MIN_MTHP_ORDER                2
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 26c0e961ac9f..8c770e251c22 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -214,7 +214,7 @@ static ssize_t max_ptes_none_store(struct kobject *kobj,
        unsigned long max_ptes_none;
 
        err = kstrtoul(buf, 10, &max_ptes_none);
-       if (err || max_ptes_none > KHUGEPAGED_MAX_PTES_LIMIT)
+       if (err || max_ptes_none > COLLAPSE_MAX_PTES_LIMIT)
                return -EINVAL;
 
        khugepaged_max_ptes_none = max_ptes_none;
@@ -239,7 +239,7 @@ static ssize_t max_ptes_swap_store(struct kobject *kobj,
        unsigned long max_ptes_swap;
 
        err  = kstrtoul(buf, 10, &max_ptes_swap);
-       if (err || max_ptes_swap > KHUGEPAGED_MAX_PTES_LIMIT)
+       if (err || max_ptes_swap > COLLAPSE_MAX_PTES_LIMIT)
                return -EINVAL;
 
        khugepaged_max_ptes_swap = max_ptes_swap;
@@ -265,7 +265,7 @@ static ssize_t max_ptes_shared_store(struct kobject *kobj,
        unsigned long max_ptes_shared;
 
        err  = kstrtoul(buf, 10, &max_ptes_shared);
-       if (err || max_ptes_shared > KHUGEPAGED_MAX_PTES_LIMIT)
+       if (err || max_ptes_shared > COLLAPSE_MAX_PTES_LIMIT)
                return -EINVAL;
 
        khugepaged_max_ptes_shared = max_ptes_shared;
@@ -330,7 +330,7 @@ int __init khugepaged_init(void)
                return -ENOMEM;
 
        khugepaged_pages_to_scan = HPAGE_PMD_NR * 8;
-       khugepaged_max_ptes_none = KHUGEPAGED_MAX_PTES_LIMIT;
+       khugepaged_max_ptes_none = COLLAPSE_MAX_PTES_LIMIT;
        khugepaged_max_ptes_swap = HPAGE_PMD_NR / 8;
        khugepaged_max_ptes_shared = HPAGE_PMD_NR / 2;
 
-- 
2.54.0


Reply via email to