[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtVTztinpOTCAAWW+0Q7SAcGfFW4PVW+bHnFQLN-nDBwSg@mail.gmail.com>
Date: Wed, 15 Dec 2021 20:34:45 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Matthew Wilcox <willy@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Shakeel Butt <shakeelb@...gle.com>,
Roman Gushchin <guro@...com>, Yang Shi <shy828301@...il.com>,
Alex Shi <alexs@...nel.org>,
Wei Yang <richard.weiyang@...il.com>,
Dave Chinner <david@...morbit.com>,
trond.myklebust@...merspace.com, anna.schumaker@...app.com,
jaegeuk@...nel.org, chao@...nel.org,
Kari Argillander <kari.argillander@...il.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
linux-nfs@...r.kernel.org, Qi Zheng <zhengqi.arch@...edance.com>,
Xiongchun duan <duanxiongchun@...edance.com>,
fam.zheng@...edance.com, Muchun Song <smuchun@...il.com>
Subject: Re: [PATCH v4 02/17] mm: introduce kmem_cache_alloc_lru
On Tue, Dec 14, 2021 at 9:50 PM Johannes Weiner <hannes@...xchg.org> wrote:
>
> On Tue, Dec 14, 2021 at 12:53:27AM +0800, Muchun Song wrote:
> > +/*
> > + * The allocated list lru pointers array is not accounted directly.
> > + * Moreover, it should not come from DMA buffer and is not readily
> > + * reclaimable. So those GFP bits should be masked off.
> > + */
> > +#define LRUS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT | __GFP_ZERO)
>
> There is already GFP_RECLAIM_MASK for this purpose, you can use that.
Cool. Thanks.
>
> > +int memcg_list_lru_alloc(struct mem_cgroup *memcg, struct list_lru *lru,
> > + gfp_t gfp)
> > +{
> > + int i;
> > + unsigned long flags;
> > + struct list_lru_memcg *mlrus;
> > + struct list_lru_memcg_table {
> > + struct list_lru_per_memcg *mlru;
> > + struct mem_cgroup *memcg;
> > + } *table;
> > +
> > + if (!list_lru_memcg_aware(lru) || memcg_list_lru_allocated(memcg, lru))
> > + return 0;
> > +
> > + gfp &= ~LRUS_CLEAR_MASK;
>
> gfp &= GFP_RECLAIM_MASK;
Powered by blists - more mailing lists