lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YbihOFJHqvQ9hsjO@cmpxchg.org>
Date:   Tue, 14 Dec 2021 14:50:48 +0100
From:   Johannes Weiner <hannes@...xchg.org>
To:     Muchun Song <songmuchun@...edance.com>
Cc:     willy@...radead.org, akpm@...ux-foundation.org, mhocko@...nel.org,
        vdavydov.dev@...il.com, shakeelb@...gle.com, guro@...com,
        shy828301@...il.com, alexs@...nel.org, richard.weiyang@...il.com,
        david@...morbit.com, trond.myklebust@...merspace.com,
        anna.schumaker@...app.com, jaegeuk@...nel.org, chao@...nel.org,
        kari.argillander@...il.com, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-nfs@...r.kernel.org, zhengqi.arch@...edance.com,
        duanxiongchun@...edance.com, fam.zheng@...edance.com,
        smuchun@...il.com
Subject: Re: [PATCH v4 02/17] mm: introduce kmem_cache_alloc_lru

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.

> +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

Powered by Openwall GNU/*/Linux Powered by OpenVZ