[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1471533810.4319.50.camel@perches.com>
Date: Thu, 18 Aug 2016 08:23:30 -0700
From: Joe Perches <joe@...ches.com>
To: Michal Hocko <mhocko@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>, Jann Horn <jann@...jh.net>
Subject: Re: [PATCH] proc, smaps: reduce printing overhead
On Thu, 2016-08-18 at 16:58 +0200, Michal Hocko wrote:
> On Thu 18-08-16 07:46:03, Joe Perches wrote:
> >
> > On Thu, 2016-08-18 at 16:41 +0200, Michal Hocko wrote:
> > >
> > > On Thu 18-08-16 16:26:16, Michal Hocko wrote:
> > > >
> > > > b) doesn't it try to be overly clever when doing that in the caller
> > > > doesn't cost all that much? Sure you can save few bytes in the spaces
> > > > but then I would just argue to use \t rather than fixed string length.
> > > ohh, I misread the code. It tries to emulate the width formater. But is
> > > this really necessary? Do we know about any tools doing a fixed string
> > > parsing?
> > I don't, but it's proc and all the output formatting
> > shouldn't be changed.
> >
> > Appended to is generally OK, but whitespace changed is
> > not good.
> OK fair enough, I will
> - seq_write(m, s, 16);
> + seq_puts(m, s);
>
> because smaps needs more than 16 chars and export it in
> fs/proc/internal.h
>
> will retest and repost.
The shift in the meminfo case uses PAGE_SHIFT too.
I suggest you make a local static instead and for
that one 17 byte line do
seq_printf(m, "Private_Hugetlb: %7lu kB\n", mss.private_hugetlb >> 10);
Another possible thing is to speed up all seq_puts
uses with fixed chars strings by avoiding the runtime
strlen and use the compiler known string length:
https://lkml.org/lkml/2016/8/11/607
Powered by blists - more mailing lists