Skip to contentSkip to conversation

mm: Rework {enabled,defrag}_{show,store}

PATCH In review Gavin Shan 3 participants 5 messages Jan 30, 2020 Memory management

lore
Share & tools
lore

Gavin Shan

author
#0 lore raw

cover mm: Rework {enabled,defrag}_{show,store}

The inappropriate settings can be accepted by "enabled" and "defrag" interface, as the following example shows. This series reworks the related functions and fixes the issue by the way.

   # cat /sys/kernel/mm/transparent_hugepage/enabled
     always [madvise] never
   # echo neveroff > /sys/kernel/mm/transparent_hugepage/enabled
   # cat /sys/kernel/mm/transparent_hugepage/enabled
     always madvise [never]

Gavin Shan (3):
mm: Rework {enabled,defrag}_store()
mm: Rework {enabled,defrag}_show()
mm: Rework setup_transparent_hugepage()

 mm/huge_memory.c | 216 +++++++++++++++++++++++++++--------------------
 1 file changed, 125 insertions(+), 91 deletions(-)
Signature · 1 line
2.23.0
#1 lore raw
Quoted 3 lines · Gavin Shan

The inappropriate settings can be accepted by "enabled" and "defrag" interface, as the following example shows. This series reworks the related functions and fixes the issue by the way.

Do we really care? This is a root only interface and we do expect root to know how to use the interface.

Quoted 17 lines
   # cat /sys/kernel/mm/transparent_hugepage/enabled
     always [madvise] never
   # echo neveroff > /sys/kernel/mm/transparent_hugepage/enabled
   # cat /sys/kernel/mm/transparent_hugepage/enabled
     always madvise [never]

Gavin Shan (3):
mm: Rework {enabled,defrag}_store()
mm: Rework {enabled,defrag}_show()
mm: Rework setup_transparent_hugepage()

 mm/huge_memory.c | 216 +++++++++++++++++++++++++++--------------------
 1 file changed, 125 insertions(+), 91 deletions(-)
Signature · 1 line
2.23.0
Signature · 2 lines
Michal Hocko
SUSE Labs
#2 lore raw
Quoted 7 lines · Michal Hocko
Quoted 3 lines · Gavin Shan

The inappropriate settings can be accepted by "enabled" and "defrag" interface, as the following example shows. This series reworks the related functions and fixes the issue by the way.

Do we really care? This is a root only interface and we do expect root to know how to use the interface.

Also I think David already solved even this case with sysfs_streq() that Andrew suggested:

https://lore.kernel.org/linux-mm/[email protected]/

Quoted 18 lines
Quoted 17 lines
   # cat /sys/kernel/mm/transparent_hugepage/enabled
     always [madvise] never
   # echo neveroff > /sys/kernel/mm/transparent_hugepage/enabled
   # cat /sys/kernel/mm/transparent_hugepage/enabled
     always madvise [never]

Gavin Shan (3):
mm: Rework {enabled,defrag}_store()
mm: Rework {enabled,defrag}_show()
mm: Rework setup_transparent_hugepage()

 mm/huge_memory.c | 216 +++++++++++++++++++++++++++--------------------
 1 file changed, 125 insertions(+), 91 deletions(-)
Signature · 1 line
2.23.0
author
#3 lore raw
Quoted 6 lines · Vlastimil Babka
Quoted 5 lines · Michal Hocko
Quoted 3 lines · Gavin Shan

The inappropriate settings can be accepted by "enabled" and "defrag" interface, as the following example shows. This series reworks the related functions and fixes the issue by the way.

Quoted 8 lines
Quoted 2 lines

Do we really care? This is a root only interface and we do expect root to know how to use the interface.

Also I think David already solved even this case with sysfs_streq() that Andrew suggested:

https://lore.kernel.org/linux-mm/[email protected]/

Thanks for the linker. I didn't notice there already have a patch to address the issue. Also, I perhaps post patch to improve the extendibility on top of David's patch if you agree. Otherwise, it can be ignored.

By the way, it's nice to know sysfs_streq().

Thanks,
Gavin

Quoted 19 lines
Quoted 18 lines
Quoted 17 lines
    # cat /sys/kernel/mm/transparent_hugepage/enabled
      always [madvise] never
    # echo neveroff > /sys/kernel/mm/transparent_hugepage/enabled
    # cat /sys/kernel/mm/transparent_hugepage/enabled
      always madvise [never]

Gavin Shan (3):
mm: Rework {enabled,defrag}_store()
mm: Rework {enabled,defrag}_show()
mm: Rework setup_transparent_hugepage()

  mm/huge_memory.c | 216 +++++++++++++++++++++++++++--------------------
  1 file changed, 125 insertions(+), 91 deletions(-)
Signature · 1 line
2.23.0
author
#4 lore raw
In reply to Michal Hocko
Quoted 8 lines · Michal Hocko
Quoted 3 lines · Gavin Shan

The inappropriate settings can be accepted by "enabled" and "defrag" interface, as the following example shows. This series reworks the related functions and fixes the issue by the way.

Do we really care? This is a root only interface and we do expect root to know how to use the interface.

I'm not sure actually, but the behavior (suffix matching) isn't well documented in admin-guide/mm/transhuge.rst at least. I think it's not bad to enforce a full matching here because even root user can input something wrong :)

Thanks,
Gavin.

Quoted 18 lines
Quoted 17 lines
    # cat /sys/kernel/mm/transparent_hugepage/enabled
      always [madvise] never
    # echo neveroff > /sys/kernel/mm/transparent_hugepage/enabled
    # cat /sys/kernel/mm/transparent_hugepage/enabled
      always madvise [never]

Gavin Shan (3):
mm: Rework {enabled,defrag}_store()
mm: Rework {enabled,defrag}_show()
mm: Rework setup_transparent_hugepage()

  mm/huge_memory.c | 216 +++++++++++++++++++++++++++--------------------
  1 file changed, 125 insertions(+), 91 deletions(-)
Signature · 1 line
2.23.0