Commit 843a2e24 authored by Bang Li's avatar Bang Li Committed by Andrew Morton

mm/shmem: fix input and output inconsistencies

Commit 19eaf449 ("mm: thp: support allocation of anonymous multi-size
THP") added 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.

Link: https://lkml.kernel.org/r/20240628032327.16987-1-libang.li@antgroup.com
Fixes: 61a57f1b1da9 ("mm: shmem: add multi-size THP sysfs interface for anonymous shmem")
Signed-off-by: default avatarBang Li <libang.li@antgroup.com>
Reviewed-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
Cc: Bang Li <libang.li@antgroup.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent cc937dad
...@@ -4983,7 +4983,7 @@ static ssize_t thpsize_shmem_enabled_store(struct kobject *kobj, ...@@ -4983,7 +4983,7 @@ static ssize_t thpsize_shmem_enabled_store(struct kobject *kobj,
clear_bit(order, &huge_shmem_orders_madvise); clear_bit(order, &huge_shmem_orders_madvise);
set_bit(order, &huge_shmem_orders_within_size); set_bit(order, &huge_shmem_orders_within_size);
spin_unlock(&huge_shmem_orders_lock); spin_unlock(&huge_shmem_orders_lock);
} else if (sysfs_streq(buf, "madvise")) { } else if (sysfs_streq(buf, "advise")) {
spin_lock(&huge_shmem_orders_lock); spin_lock(&huge_shmem_orders_lock);
clear_bit(order, &huge_shmem_orders_always); clear_bit(order, &huge_shmem_orders_always);
clear_bit(order, &huge_shmem_orders_inherit); clear_bit(order, &huge_shmem_orders_inherit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment