mm,thp: fix sloppy text output
Subsystems (6)
cover mm,thp: fix sloppy text output
mm,thp: fix sloppy text output
Three independent trivial patches, fixing sloppy text output which has annoyed me; but might risk surprising a parser, so any can be dropped.
1/3 mm,thp: no space after colon in Mem-Info fields 2/3 mm,thp: fix nodeN/meminfo output alignment 3/3 mm,thp: fix smaps THPeligible output alignment
drivers/base/node.c | 4 ++-- fs/proc/task_mmu.c | 2 +- mm/show_mem.c | 6 +++--- tools/testing/selftests/proc/proc-empty-vm.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
Hugh
PATCH 1/3 mm,thp: no space after colon in Mem-Info fields
The SysRq-m or OOM Mem-Info dmesg showed (long lines containing) ... shmem:NkB shmem_thp: NkB shmem_pmdmapped: NkB anon_thp: NkB ...
Delete the space after the colon after shmem_thp, shmem_pmdmapped,anon_thp: as the shmem example shows, no other fields have a space after the colon in this output.
--- mm/show_mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/show_mem.c +3 -3
@@ -251,9 +251,9 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z " writeback:%lukB" " shmem:%lukB" #ifdef CONFIG_TRANSPARENT_HUGEPAGE - " shmem_thp: %lukB" - " shmem_pmdmapped: %lukB" - " anon_thp: %lukB" + " shmem_thp:%lukB" + " shmem_pmdmapped:%lukB" + " anon_thp:%lukB" #endif" writeback_tmp:%lukB" " kernel_stack:%lukB"
Signature · 1 line
2.35.3
Re: [PATCH 1/3] mm,thp: no space after colon in Mem-Info fields
Quoted 19 lines · Hugh Dickins
The SysRq-m or OOM Mem-Info dmesg showed (long lines containing) ... shmem:NkB
shmem_thp: NkBshmem_pmdmapped: NkBanon_thp: NkB ...Delete the space after the colon after
shmem_thp,shmem_pmdmapped,anon_thp: as the shmem example shows, no other fields have a space after the colon in this output.Signed-off-by Hugh Dickins <[email protected]>--- mm/show_mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)mm/show_mem.c +0
-0@@ -251,9 +251,9 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z" writeback:%lukB" " shmem:%lukB"
mm/show_mem.c static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z · line 259
Quoted 10 lines
mm/show_mem.c +3
-3#ifdef CONFIG_TRANSPARENT_HUGEPAGE -" shmem_thp: %lukB" -" shmem_pmdmapped: %lukB" - " anon_thp: %lukB" +" shmem_thp:%lukB" +" shmem_pmdmapped:%lukB" + " anon_thp:%lukB"#endif " writeback_tmp:%lukB" " kernel_stack:%lukB"
Signature · 3 lines
Cheers, David / dhildenb
PATCH 2/3 mm,thp: fix nodeN/meminfo output alignment
In reply to Hugh DickinsAdd one more space to FileHugePages and FilePmdMapped, so the output is aligned with other rows in /sys/devices/system/node/nodeN/meminfo.
--- drivers/base/node.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/node.c +2 -2
@@ -446,8 +446,8 @@ static ssize_t node_read_meminfo(struct device *dev,"Node %d AnonHugePages: %8lu kB\n" "Node %d ShmemHugePages: %8lu kB\n" "Node %d ShmemPmdMapped: %8lu kB\n" -"Node %d FileHugePages: %8lu kB\n" - "Node %d FilePmdMapped: %8lu kB\n" +"Node %d FileHugePages: %8lu kB\n" + "Node %d FilePmdMapped: %8lu kB\n"#endif #ifdef CONFIG_UNACCEPTED_MEMORY "Node %d Unaccepted: %8lu kB\n"
Signature · 1 line
2.35.3
Re: [PATCH 2/3] mm,thp: fix nodeN/meminfo output alignment
Quoted 13 lines · Hugh Dickins
Add one more space to FileHugePages and FilePmdMapped, so the output is aligned with other rows in
/sys/devices/system/node/nodeN/meminfo.Signed-off-by Hugh Dickins <[email protected]>--- drivers/base/node.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/base/node.c +0
-0
drivers/base/node.c static ssize_t node_read_meminfo(struct device *dev, · line 453
Quoted 10 lines
drivers/base/node.c +2
-2@@ -446,8 +446,8 @@ static ssize_t node_read_meminfo(struct device *dev,"Node %d AnonHugePages: %8lu kB\n" "Node %d ShmemHugePages: %8lu kB\n" "Node %d ShmemPmdMapped: %8lu kB\n" -"Node %d FileHugePages: %8lu kB\n" - "Node %d FilePmdMapped: %8lu kB\n" +"Node %d FileHugePages: %8lu kB\n" + "Node %d FilePmdMapped: %8lu kB\n"#endif #ifdef CONFIG_UNACCEPTED_MEMORY "Node %d Unaccepted: %8lu kB\n"
Signature · 3 lines
Cheers, David / dhildenb
PATCH 3/3 mm,thp: fix smaps THPeligible output alignment
In reply to Hugh DickinsExtract from current /proc/self/smaps output:
Swap: 0 kB SwapPss: 0 kB Locked: 0 kB THPeligible: 0 ProtectionKey: 0
That's not the alignment shown in Documentation/filesystems/proc.rst:
it's an ugly artifact from missing out the %8 other fields are using; but there's even one selftest which expects it to look that way. Hoping no other smaps parsers depend on THPeligible to look so ugly, fix these.
--- fs/proc/task_mmu.c | 2 +- tools/testing/selftests/proc/proc-empty-vm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/proc/task_mmu.c +1 -1
@@ -855,7 +855,7 @@ static int show_smap(struct seq_file *m, void *v)__show_smap (m, &mss, false); -seq_printf (m,"THPeligible: %d\n" , +seq_printf (m,"THPeligible: %8u\n" ,hugepage_vma_check (vma, vma->vm_flags, true, false, true));if (arch_pkeys_enabled ())
tools/testing/selftests/proc/proc-empty-vm.c +2 -2
@@ -82,7 +82,7 @@ static const char proc_pid_smaps_vsyscall_1[] ="Swap: 0 kB\n" "SwapPss: 0 kB\n" "Locked: 0 kB\n" -"THPeligible: 0\n" +"THPeligible: 0\n" /* * "ProtectionKey:" field is conditional. It is possible to check it as well, * but I don't have such machine.
@@ -112,7 +112,7 @@ static const char proc_pid_smaps_vsyscall_2[] ="Swap: 0 kB\n" "SwapPss: 0 kB\n" "Locked: 0 kB\n" -"THPeligible: 0\n" +"THPeligible: 0\n" /* * "ProtectionKey:" field is conditional. It is possible to check it as well, * but I'm too tired.
Signature · 1 line
2.35.3
Re: [PATCH 3/3] mm,thp: fix smaps THPeligible output alignment
fs/proc/task_mmu.c static int show_smap(struct seq_file *m, void *v) · line 859
Quoted 9 lines · Hugh Dickins
Swap: 0 kB SwapPss: 0 kB Locked: 0 kB THPeligible: 0 ProtectionKey: 0fs/proc/task_mmu.c +1
-1-seq_printf (m,"THPeligible: %d\n" , +seq_printf (m,"THPeligible: %8u\n" ,hugepage_vma_check (vma, vma->vm_flags, true, false, true));
Why format string change? It would only slow down printing.
I'd print with
"%u", +hugepage_vma_check()
or just add whitespace.
Re: [PATCH 3/3] mm,thp: fix smaps THPeligible output alignment
Quoted 7 lines · Alexey Dobriyan
Quoted 5 lines · Hugh Dickins
Swap: 0 kB SwapPss: 0 kB Locked: 0 kB THPeligible: 0 ProtectionKey: 0
Quoted 5 lines
fs/proc/task_mmu.c static int show_smap(struct seq_file *m, void *v) · line 859
Quoted 3 lines
fs/proc/task_mmu.c +1
-1-seq_printf (m,"THPeligible: %d\n" , +seq_printf (m,"THPeligible: %8u\n" ,hugepage_vma_check (vma, vma->vm_flags, true, false, true));Why format string change? It would only slow down printing.
To document the alignment, and to look like the ProtectionKey line below.
Quoted 4 lines
I'd print with
"%u", +hugepage_vma_check()
Sorry, I don't understand.
Quoted 2 lines
or just add whitespace.
My original patch did that, then I thought it better to document the alignment and save those bytes of kernel.
Hugh