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: <2a1c9796-c55a-4a4d-99d2-3095fdec6ec0@suse.cz>
Date: Thu, 27 Nov 2025 18:42:47 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 Andrew Morton <akpm@...ux-foundation.org>
Cc: Christian Borntraeger <borntraeger@...ux.ibm.com>,
 Janosch Frank <frankja@...ux.ibm.com>,
 Claudio Imbrenda <imbrenda@...ux.ibm.com>,
 David Hildenbrand <david@...hat.com>,
 Alexander Gordeev <agordeev@...ux.ibm.com>,
 Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
 Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
 Sven Schnelle <svens@...ux.ibm.com>, Peter Xu <peterx@...hat.com>,
 Alexander Viro <viro@...iv.linux.org.uk>,
 Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
 Arnd Bergmann <arnd@...db.de>, Zi Yan <ziy@...dia.com>,
 Baolin Wang <baolin.wang@...ux.alibaba.com>,
 "Liam R . Howlett" <Liam.Howlett@...cle.com>, Nico Pache
 <npache@...hat.com>, Ryan Roberts <ryan.roberts@....com>,
 Dev Jain <dev.jain@....com>, Barry Song <baohua@...nel.org>,
 Lance Yang <lance.yang@...ux.dev>, Muchun Song <muchun.song@...ux.dev>,
 Oscar Salvador <osalvador@...e.de>, Mike Rapoport <rppt@...nel.org>,
 Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
 Matthew Brost <matthew.brost@...el.com>,
 Joshua Hahn <joshua.hahnjy@...il.com>, Rakie Kim <rakie.kim@...com>,
 Byungchul Park <byungchul@...com>, Gregory Price <gourry@...rry.net>,
 Ying Huang <ying.huang@...ux.alibaba.com>,
 Alistair Popple <apopple@...dia.com>,
 Axel Rasmussen <axelrasmussen@...gle.com>, Yuanchu Xie <yuanchu@...gle.com>,
 Wei Xu <weixugc@...gle.com>, Kemeng Shi <shikemeng@...weicloud.com>,
 Kairui Song <kasong@...cent.com>, Nhat Pham <nphamcs@...il.com>,
 Baoquan He <bhe@...hat.com>, Chris Li <chrisl@...nel.org>,
 SeongJae Park <sj@...nel.org>, Matthew Wilcox <willy@...radead.org>,
 Jason Gunthorpe <jgg@...pe.ca>, Leon Romanovsky <leon@...nel.org>,
 Xu Xin <xu.xin16@....com.cn>, Chengming Zhou <chengming.zhou@...ux.dev>,
 Jann Horn <jannh@...gle.com>, Miaohe Lin <linmiaohe@...wei.com>,
 Naoya Horiguchi <nao.horiguchi@...il.com>, Pedro Falcato <pfalcato@...e.de>,
 Pasha Tatashin <pasha.tatashin@...een.com>, Rik van Riel <riel@...riel.com>,
 Harry Yoo <harry.yoo@...cle.com>, Hugh Dickins <hughd@...gle.com>,
 linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
 linux-s390@...r.kernel.org, linux-fsdevel@...r.kernel.org,
 linux-mm@...ck.org, linux-arch@...r.kernel.org, damon@...ts.linux.dev
Subject: Re: [PATCH v3 15/16] mm: eliminate further swapops predicates

On 11/10/25 23:21, Lorenzo Stoakes wrote:
> Having converted so much of the code base to software leaf entries, we can
> mop up some remaining cases.
> 
> We replace is_pfn_swap_entry(), pfn_swap_entry_to_page(),
> is_writable_device_private_entry(), is_device_exclusive_entry(),
> is_migration_entry(), is_writable_migration_entry(),
> is_readable_migration_entry(), swp_offset_pfn() and pfn_swap_entry_folio()
> with softleaf equivalents.
> 
> No functional change intended.
> 
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>

Reviewed-by: Vlastimil Babka <vbabka@...e.cz>

Two completely non-urgent nits below.

> ---
>  16 files changed, 75 insertions(+), 176 deletions(-)

Nice.

> index f5ea9b0385ff..d282fab866a1 100644
> --- a/include/linux/leafops.h
> +++ b/include/linux/leafops.h
> @@ -355,7 +355,7 @@ static inline unsigned long softleaf_to_pfn(softleaf_t entry)
>  	VM_WARN_ON_ONCE(!softleaf_has_pfn(entry));
>  
>  	/* Temporary until swp_entry_t eliminated. */
> -	return swp_offset_pfn(entry);
> +	return swp_offset(entry) & SWP_PFN_MASK;
>  }
>  
>  /**
> @@ -366,10 +366,16 @@ static inline unsigned long softleaf_to_pfn(softleaf_t entry)
>   */
>  static inline struct page *softleaf_to_page(softleaf_t entry)
>  {
> +	struct page *page = pfn_to_page(softleaf_to_pfn(entry));
> +
>  	VM_WARN_ON_ONCE(!softleaf_has_pfn(entry));

Nit: the warning is already in softleaf_to_pfn()

> +	/*
> +	 * Any use of migration entries may only occur while the
> +	 * corresponding page is locked
> +	 */
> +	VM_WARN_ON_ONCE(softleaf_is_migration(entry) && !PageLocked(page));
>  
> -	/* Temporary until swp_entry_t eliminated. */
> -	return pfn_swap_entry_to_page(entry);
> +	return page;
>  }
>  
>  /**
> @@ -380,10 +386,17 @@ static inline struct page *softleaf_to_page(softleaf_t entry)
>   */
>  static inline struct folio *softleaf_to_folio(softleaf_t entry)
>  {
> -	VM_WARN_ON_ONCE(!softleaf_has_pfn(entry));
> +	struct folio *folio = pfn_folio(softleaf_to_pfn(entry));
>  
> -	/* Temporary until swp_entry_t eliminated. */
> -	return pfn_swap_entry_folio(entry);
> +	VM_WARN_ON_ONCE(!softleaf_has_pfn(entry));

Ditto.

> +	/*
> +	 * Any use of migration entries may only occur while the
> +	 * corresponding folio is locked.
> +	 */
> +	VM_WARN_ON_ONCE(softleaf_is_migration(entry) &&
> +			!folio_test_locked(folio));
> +
> +	return folio;
>  }
>  
>  /**

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ