Skip to contentSkip to conversation

/proc/PID/smaps: Consistent whitespace output format

PATCH Applied Michal Koutný 2 participants 2 messages Jul 28, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /proc/PID/smaps: Consistent whitespace output format

The keys in smaps output are padded to fixed width with spaces. All except for THPeligible that uses tabs (only since commit c06306696f83 ("mm: thp: fix false negative of shmem vma's THP eligibility")).
Unify the output formatting to save time debugging some naïve parsers. (Part of the unification is also aligning FilePmdMapped with others.)

---
 fs/proc/task_mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/proc/task_mmu.c +2 -2
index dbda4499a859..5066b0251ed8 100644
@@ -786,7 +786,7 @@ static void __show_smap(struct seq_file *m, const struct mem_size_stats *mss,
 	SEQ_PUT_DEC(" kB\nLazyFree:       ", mss->lazyfree);
 	SEQ_PUT_DEC(" kB\nAnonHugePages:  ", mss->anonymous_thp);
 	SEQ_PUT_DEC(" kB\nShmemPmdMapped: ", mss->shmem_thp);
-	SEQ_PUT_DEC(" kB\nFilePmdMapped: ", mss->file_thp);
+	SEQ_PUT_DEC(" kB\nFilePmdMapped:  ", mss->file_thp);
 	SEQ_PUT_DEC(" kB\nShared_Hugetlb: ", mss->shared_hugetlb);
 	seq_put_decimal_ull_width(m, " kB\nPrivate_Hugetlb: ",
 				  mss->private_hugetlb >> 10, 7);
@@ -816,7 +816,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:    %d\n",
 		   transparent_hugepage_enabled(vma));
 
 	if (arch_pkeys_enabled())
Signature · 1 line
2.27.0
#1 lore raw
Quoted 6 lines · Michal Koutný

The keys in smaps output are padded to fixed width with spaces. All except for THPeligible that uses tabs (only since commit c06306696f83 ("mm: thp: fix false negative of shmem vma's THP eligibility")).
Unify the output formatting to save time debugging some naïve parsers. (Part of the unification is also aligning FilePmdMapped with others.)

I recalled someone else submitted similar patch before. But my memory is vague. Anyway it looks fine to me to make the parsers happy. Acked-by: Yang Shi <[email protected]>

Quoted 28 lines
---
  fs/proc/task_mmu.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/proc/task_mmu.c +2 -2
index dbda4499a859..5066b0251ed8 100644
@@ -786,7 +786,7 @@ static void __show_smap(struct seq_file *m, const struct mem_size_stats *mss,
  	SEQ_PUT_DEC(" kB\nLazyFree:       ", mss->lazyfree);
  	SEQ_PUT_DEC(" kB\nAnonHugePages:  ", mss->anonymous_thp);
  	SEQ_PUT_DEC(" kB\nShmemPmdMapped: ", mss->shmem_thp);
-	SEQ_PUT_DEC(" kB\nFilePmdMapped: ", mss->file_thp);
+	SEQ_PUT_DEC(" kB\nFilePmdMapped:  ", mss->file_thp);
  	SEQ_PUT_DEC(" kB\nShared_Hugetlb: ", mss->shared_hugetlb);
  	seq_put_decimal_ull_width(m, " kB\nPrivate_Hugetlb: ",
  				  mss->private_hugetlb >> 10, 7);
@@ -816,7 +816,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:    %d\n",
  		   transparent_hugepage_enabled(vma));
 
  	if (arch_pkeys_enabled())