Re: [PATCH V5 6/6] proc: show MADV_FREE pages info in smaps

From: Andrew Morton
Date: Tue Mar 07 2017 - 20:22:24 EST


On Tue, 7 Mar 2017 11:05:45 +0100 Michal Hocko <mhocko@xxxxxxxxxx> wrote:

> On Fri 03-03-17 16:10:27, Andrew Morton wrote:
> > On Thu, 2 Mar 2017 17:30:54 +0100 Michal Hocko <mhocko@xxxxxxxxxx> wrote:
> >
> > > > It's not that I think you're wrong: it *is* an implementation detail.
> > > > But we take a bit of incoherency from batching all over the place, so
> > > > it's a little odd to take a stand over this particular instance of it
> > > > - whether demanding that it'd be fixed, or be documented, which would
> > > > only suggest to users that this is special when it really isn't etc.
> > >
> > > I am not aware of other counter printed in smaps that would suffer from
> > > the same problem, but I haven't checked too deeply so I might be wrong.
> > >
> > > Anyway it seems that I am alone in my position so I will not insist.
> > > If we have any bug report then we can still fix it.
> >
> > A single lru_add_drain_all() right at the top level (in smaps_show()?)
> > won't kill us
>
> I do not think we want to put lru_add_drain_all cost to a random
> process reading /proc/<pid>/smaps.

Why not? It's that process which is calling for the work to be done.

> If anything the one which does the
> madvise should be doing this.

But it would be silly to do extra work in madvise() if nobody will be
reading smaps for the next two months.

How much work is it anyway? What would be the relative impact upon a
smaps read?