Skip to contentSkip to conversation

mm/shmem: Fix input and output inconsistencies

PATCH Applied Bang Li 2 participants 2 messages Jun 28, 2024

Subsystems (2)
lore
Share & tools
lore

Bang Li

author
#0 lore raw

PATCH 1/1 mm/shmem: Fix input and output inconsistencies

After the commit 19eaf44954df ("mm: thp: support allocation of anonymous multi-size THP"), add mTHP support for anonymous shmem. We can configure different policies through the multi-size THP sysfs interface for anonymous shmem.

But when we configure the "advise" policy of /sys/kernel/mm/transparent_hugepage/hugepages-xxxkB/shmem_enabled, we cannot write the "advise", but write the "madvise", which is unreasonable. We should keep the output and input values consistent, which is more convenient for users.

Fixes 61a57f1b1da9 ("mm: shmem: add multi-size THP sysfs interface for anonymous shmem")
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
index 13d139abe69a..d495c0701a83 100644
@@ -4983,7 +4983,7 @@ static ssize_t thpsize_shmem_enabled_store(struct kobject *kobj,
 		clear_bit(order, &huge_shmem_orders_madvise);
 		set_bit(order, &huge_shmem_orders_within_size);
 		spin_unlock(&huge_shmem_orders_lock);
-	} else if (sysfs_streq(buf, "madvise")) {
+	} else if (sysfs_streq(buf, "advise")) {
 		spin_lock(&huge_shmem_orders_lock);
 		clear_bit(order, &huge_shmem_orders_always);
 		clear_bit(order, &huge_shmem_orders_inherit);
Signature · 1 line
2.19.1.6.gb485710b
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Bang Li

After the commit 19eaf44954df ("mm: thp: support allocation of anonymous multi-size THP"), add mTHP support for anonymous shmem. We can configure different policies through the multi-size THP sysfs interface for anonymous shmem.

Quoted 8 lines

But when we configure the "advise" policy of /sys/kernel/mm/transparent_hugepage/hugepages-xxxkB/shmem_enabled, we cannot write the "advise", but write the "madvise", which is unreasonable. We should keep the output and input values consistent, which is more convenient for users.

Fixes 61a57f1b1da9 ("mm: shmem: add multi-size THP sysfs interface for anonymous shmem")

Good catch. Sorry for my typo. Thanks.

Quoted 17 lines
---
  mm/shmem.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
index 13d139abe69a..d495c0701a83 100644
@@ -4983,7 +4983,7 @@ static ssize_t thpsize_shmem_enabled_store(struct kobject *kobj,
  		clear_bit(order, &huge_shmem_orders_madvise);
  		set_bit(order, &huge_shmem_orders_within_size);
  		spin_unlock(&huge_shmem_orders_lock);
-	} else if (sysfs_streq(buf, "madvise")) {
+	} else if (sysfs_streq(buf, "advise")) {
  		spin_lock(&huge_shmem_orders_lock);
  		clear_bit(order, &huge_shmem_orders_always);
  		clear_bit(order, &huge_shmem_orders_inherit);