[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210313205107.673f342d4bef4b2932ecd55f@linux-foundation.org>
Date: Sat, 13 Mar 2021 20:51:07 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4 03/25] mm/vmstat: Add functions to account folio
statistics
On Sun, 14 Mar 2021 04:11:55 +0000 Matthew Wilcox <willy@...radead.org> wrote:
> On Sat, Mar 13, 2021 at 12:37:07PM -0800, Andrew Morton wrote:
> > On Fri, 5 Mar 2021 04:18:39 +0000 "Matthew Wilcox (Oracle)" <willy@...radead.org> wrote:
> >
> > > Allow page counters to be more readily modified by callers which have
> > > a folio. Name these wrappers with 'stat' instead of 'state' as requested
> > > by Linus here:
> > > https://lore.kernel.org/linux-mm/CAHk-=wj847SudR-kt+46fT3+xFFgiwpgThvm7DJWGdi4cVrbnQ@mail.gmail.com/
> > >
> > > --- a/include/linux/vmstat.h
> > > +++ b/include/linux/vmstat.h
> > > @@ -402,6 +402,54 @@ static inline void drain_zonestat(struct zone *zone,
> > > struct per_cpu_pageset *pset) { }
> > > #endif /* CONFIG_SMP */
> > >
> > > +static inline
> > > +void __inc_zone_folio_stat(struct folio *folio, enum zone_stat_item item)
> > > +{
> > > + __mod_zone_page_state(folio_zone(folio), item, folio_nr_pages(folio));
> > > +}
> >
> > The naming is unfortunate. We expect
> >
> > inc: add one to
> > dec: subtract one from
> > mod: modify by signed quantity
> >
> > So these are inconsistent. Perhaps use "add" and "sub" instead. At
> > least to alert people to the fact that these are different.
> >
> > And, again, it's nice to see the subsystem's name leading the
> > identifiers, so "zone_folio_stat_add()".
>
> I thought this was a 'zone stat', so __zone_stat_add_folio()?
> I'm not necessarily signing up to change the existing
> __inc_node_page_state(), but I might. If so, __node_stat_add_page()?
That works. It's the "inc means +1" and "dec means -1" whiplash that
struck me the most.
Powered by blists - more mailing lists