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: <160b54f1-b578-40d5-a977-00b71fd22e34@linux.dev>
Date: Thu, 28 Mar 2024 16:15:49 +0800
From: Chengming Zhou <chengming.zhou@...ux.dev>
To: Yosry Ahmed <yosryahmed@...gle.com>,
 Andrew Morton <akpm@...ux-foundation.org>
Cc: Johannes Weiner <hannes@...xchg.org>, Nhat Pham <nphamcs@...il.com>,
 linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 8/9] mm: zswap: do not check the global limit for
 zero-filled pages

On 2024/3/26 07:50, Yosry Ahmed wrote:
> When storing zero-filled pages, there is no point of checking the global
> zswap limit. These pages do not consume any memory that contributes
> toward the limit. Move the limit checking after zero-filled pages are
> handled.
> 
> This avoids having zero-filled pages skip zswap and go to disk swap if
> the limit is hit. It also avoids queueing the shrink worker, which may
> end up being unnecessary if the zswap usage goes down on its own before
> another store is attempted.
> 
> Ignoring the memcg limits as well for zero-filled pages is more
> controversial. Those limits are more a matter of per-workload policy.
> Some workloads disable zswap completely by setting memory.zswap.max = 0,
> and those workloads could start observing some zswap activity even after
> disabling zswap. Although harmless, this could cause confusion to
> userspace. Remain conservative and keep respecting those limits.
> 
> Signed-off-by: Yosry Ahmed <yosryahmed@...gle.com>

Yeah, it looks reasonable to keep the memcg limits check.

Reviewed-by: Chengming Zhou <chengming.zhou@...ux.dev>

Thanks.

> ---
>  mm/zswap.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/zswap.c b/mm/zswap.c
> index efc323bab2f22..9357328d940af 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1460,9 +1460,6 @@ bool zswap_store(struct folio *folio)
>  		mem_cgroup_put(memcg);
>  	}
>  
> -	if (!zswap_check_limit())
> -		goto reject;
> -
>  	if (zswap_is_folio_zero_filled(folio)) {
>  		if (zswap_store_zero_filled(tree, offset, objcg))
>  			goto reject;
> @@ -1472,6 +1469,9 @@ bool zswap_store(struct folio *folio)
>  	if (!zswap_non_zero_filled_pages_enabled)
>  		goto reject;
>  
> +	if (!zswap_check_limit())
> +		goto reject;
> +
>  	entry = zswap_entry_cache_alloc(GFP_KERNEL, folio_nid(folio));
>  	if (!entry) {
>  		zswap_reject_kmemcache_fail++;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ