mm,thp: fix smaps THPeligible output alignment
authorHugh Dickins <hughd@google.com>
Mon, 14 Aug 2023 20:02:08 +0000 (13:02 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 21 Aug 2023 20:38:01 +0000 (13:38 -0700)
Extract 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.

Link: https://lkml.kernel.org/r/cfb81f7a-f448-5bc2-b0e1-8136fcd1dd8c@google.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/task_mmu.c
tools/testing/selftests/proc/proc-empty-vm.c

index bf25178..74cbb00 100644 (file)
@@ -854,7 +854,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())
index 7588428..e105244 100644 (file)
@@ -77,7 +77,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.
@@ -107,7 +107,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.