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: <1937798a-1f63-44ea-8c30-1040174eb1c9@linux.alibaba.com>
Date: Tue, 2 Dec 2025 15:04:58 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: Kairui Song <ryncsn@...il.com>, linux-mm@...ck.org
Cc: Andrew Morton <akpm@...ux-foundation.org>, Baoquan He <bhe@...hat.com>,
 Barry Song <baohua@...nel.org>, Chris Li <chrisl@...nel.org>,
 Nhat Pham <nphamcs@...il.com>, Yosry Ahmed <yosry.ahmed@...ux.dev>,
 David Hildenbrand <david@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
 Youngjun Park <youngjun.park@....com>, Hugh Dickins <hughd@...gle.com>,
 Ying Huang <ying.huang@...ux.alibaba.com>,
 Kemeng Shi <shikemeng@...weicloud.com>,
 Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 "Matthew Wilcox (Oracle)" <willy@...radead.org>,
 linux-kernel@...r.kernel.org, Kairui Song <kasong@...cent.com>
Subject: Re: [PATCH v3 08/19] mm/shmem, swap: remove SWAP_MAP_SHMEM



On 2025/11/25 03:13, Kairui Song wrote:
> From: Nhat Pham <nphamcs@...il.com>
> 
> The SWAP_MAP_SHMEM state was introduced in the commit aaa468653b4a
> ("swap_info: note SWAP_MAP_SHMEM"), to quickly determine if a swap entry
> belongs to shmem during swapoff.
> 
> However, swapoff has since been rewritten in the commit b56a2d8af914
> ("mm: rid swapoff of quadratic complexity"). Now having swap count ==
> SWAP_MAP_SHMEM value is basically the same as having swap count == 1,
> and swap_shmem_alloc() behaves analogously to swap_duplicate(). The only
> difference of note is that swap_shmem_alloc() does not check for
> -ENOMEM returned from __swap_duplicate(), but it is OK because shmem
> never re-duplicates any swap entry it owns. This will stil be safe if we
> use (batched) swap_duplicate() instead.
> 
> This commit adds swap_duplicate_nr(), the batched variant of
> swap_duplicate(), and removes the SWAP_MAP_SHMEM state and the
> associated swap_shmem_alloc() helper to simplify the state machine (both
> mentally and in terms of actual code). We will also have an extra
> state/special value that can be repurposed (for swap entries that never
> gets re-duplicated).
> 
> Signed-off-by: Nhat Pham <nphamcs@...il.com>
> Signed-off-by: Kairui Song <kasong@...cent.com>
> ---

LGTM. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
Tested-by: Baolin Wang <baolin.wang@...ux.alibaba.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ