Re: [PATCH 4/5] mm: rework non-root kmem_cache lifecycle management

From: Roman Gushchin
Date: Thu Apr 18 2019 - 14:25:29 EST


On Thu, Apr 18, 2019 at 01:38:44PM +0000, Christopher Lameter wrote:
> On Wed, 17 Apr 2019, Roman Gushchin wrote:
>
> > static __always_inline int memcg_charge_slab(struct page *page,
> > gfp_t gfp, int order,
> > struct kmem_cache *s)
> > {
> > - if (is_root_cache(s))
> > + int idx = (s->flags & SLAB_RECLAIM_ACCOUNT) ?
> > + NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE;
> > + struct mem_cgroup *memcg;
> > + struct lruvec *lruvec;
> > + int ret;
> > +
> > + if (is_root_cache(s)) {
> > + mod_node_page_state(page_pgdat(page), idx, 1 << order);
>
> Hmmm... This is functionality that is not memcg specific being moved into
> a memcg function??? Maybe rename the function to indicate that it is not
> memcg specific and add the proper #ifdefs?
>
> > static __always_inline void memcg_uncharge_slab(struct page *page, int order,
> > struct kmem_cache *s)
> > {
> > - memcg_kmem_uncharge(page, order);
> > + int idx = (s->flags & SLAB_RECLAIM_ACCOUNT) ?
> > + NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE;
> > + struct mem_cgroup *memcg;
> > + struct lruvec *lruvec;
> > +
> > + if (is_root_cache(s)) {
> > + mod_node_page_state(page_pgdat(page), idx, -(1 << order));
> > + return;
> > + }
>
> And again.
>

Good point! Will do in v2.

Thanks!