[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200930234445.GA2700710@carbon.dhcp.thefacebook.com>
Date: Wed, 30 Sep 2020 16:44:45 -0700
From: Roman Gushchin <guro@...com>
To: Shakeel Butt <shakeelb@...gle.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux MM <linux-mm@...ck.org>, Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v3 3/4] mm: introduce page memcg flags
On Wed, Sep 30, 2020 at 04:35:37PM -0700, Shakeel Butt wrote:
> On Tue, Sep 29, 2020 at 4:59 PM Roman Gushchin <guro@...com> wrote:
> >
> > The lowest bit in page->memcg_data is used to distinguish between
> > struct memory_cgroup pointer and a pointer to a objcgs array.
> > All checks and modifications of this bit are open-coded.
> >
> > Let's formalize it using page memcg flags, defined in enum
> > page_memcg_data_flags.
> >
> > Additional flags might be added later.
> >
> > Signed-off-by: Roman Gushchin <guro@...com>
>
> One nit below:
>
> Reviewed-by: Shakeel Butt <shakeelb@...gle.com>
Thank you!
>
> > ---
> > include/linux/memcontrol.h | 35 ++++++++++++++++++++++++-----------
> > 1 file changed, 24 insertions(+), 11 deletions(-)
> >
> > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> > index d4d15c04bbaf..35f846c6b89b 100644
> > --- a/include/linux/memcontrol.h
> > +++ b/include/linux/memcontrol.h
> > @@ -343,6 +343,15 @@ struct mem_cgroup {
> >
> > extern struct mem_cgroup *root_mem_cgroup;
> >
> > +enum page_memcg_data_flags {
> > + /* page->memcg_data is a pointer to an objcgs vector */
> > + MEMCG_DATA_OBJCGS,
> > + /* the next bit after the last actual flag */
> > + __NR_MEMCG_DATA_FLAGS,
> > +};
> > +
> > +#define MEMCG_DATA_FLAGS_MASK ((0x1UL << __NR_MEMCG_DATA_FLAGS) - 1)
> > +
>
> Nit:
>
> #define PG_MEMCG_OBJCGS (0x1UL << MEMCG_DATA_OBJCGS)
>
> and use this macro below.
Johannes's pushing on defining flags as bit fields, so I'm sending v4 soon.
Thanks!
Powered by blists - more mailing lists