linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] /proc/PID/smaps: Consistent whitespace output format
@ 2020-07-28  8:32 Michal Koutný
  2020-07-28 16:57 ` Yang Shi
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Koutný @ 2020-07-28  8:32 UTC (permalink / raw)
  To: Alexey Dobriyan, Andrew Morton
  Cc: Matthew Wilcox, Yang Shi, linux-kernel, linux-fsdevel,
	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.)

Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
 fs/proc/task_mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index dbda4499a859..5066b0251ed8 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -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())
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] /proc/PID/smaps: Consistent whitespace output format
  2020-07-28  8:32 [PATCH] /proc/PID/smaps: Consistent whitespace output format Michal Koutný
@ 2020-07-28 16:57 ` Yang Shi
  0 siblings, 0 replies; 2+ messages in thread
From: Yang Shi @ 2020-07-28 16:57 UTC (permalink / raw)
  To: Michal Koutný, Alexey Dobriyan, Andrew Morton
  Cc: Matthew Wilcox, linux-kernel, linux-fsdevel



On 7/28/20 1:32 AM, Michal Koutný wrote:
> 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 <yang.shi@linux.alibaba.com>

>
> Signed-off-by: Michal Koutný <mkoutny@suse.com>
> ---
>   fs/proc/task_mmu.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index dbda4499a859..5066b0251ed8 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -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())


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-28 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28  8:32 [PATCH] /proc/PID/smaps: Consistent whitespace output format Michal Koutný
2020-07-28 16:57 ` Yang Shi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).