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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68f18daf-cc45-479f-ac6f-0b4dce153ea7@suse.cz>
Date: Fri, 21 Nov 2025 19:42:50 +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 10/16] mm: replace pmd_to_swp_entry() with
 softleaf_from_pmd()

On 11/10/25 23:21, Lorenzo Stoakes wrote:
> Introduce softleaf_from_pmd() to do the equivalent operation for PMDs that
> softleaf_from_pte() fulfils, and cascade changes through code base
> accordingly, introducing helpers as necessary.

Some of that is adding new pte stuff too, so it could have been separate
patch, but it's not a big deal.

> We are then able to eliminate pmd_to_swp_entry(), is_pmd_migration_entry(),
> is_pmd_device_private_entry() and is_pmd_non_present_folio_entry().
> 
> This further establishes the use of leaf operations throughout the code
> base and further establishes the foundations for eliminating is_swap_pmd().
> 
> No functional change intended.
> 
> Reviewed-by: SeongJae Park <sj@...nel.org>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>

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

Assuming the below is fixed. Glad I could demonstrate I'm not just rubber
stamping all this ;P
(probably missed stuff anyway, as usual)

> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -8,7 +8,7 @@
>  #include <linux/mm.h>
>  #include <linux/page_table_check.h>
>  #include <linux/swap.h>
> -#include <linux/swapops.h>
> +#include <linux/leafops.h>
>  
>  #undef pr_fmt
>  #define pr_fmt(fmt)	"page_table_check: " fmt
> @@ -179,10 +179,10 @@ void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud)
>  EXPORT_SYMBOL(__page_table_check_pud_clear);
>  
>  /* Whether the swap entry cached writable information */
> -static inline bool swap_cached_writable(swp_entry_t entry)
> +static inline bool softleaf_cached_writable(softleaf_t entry)
>  {
> -	return is_writable_device_private_entry(entry) ||
> -	       is_writable_migration_entry(entry);
> +	return softleaf_is_device_private(entry) ||

Shouldn't there be softleaf_is_device_private_write(entry) ?

> +		softleaf_is_migration_write(entry);
>  }
>  
>  static void page_table_check_pte_flags(pte_t pte)
> @@ -190,9 +190,9 @@ static void page_table_check_pte_flags(pte_t pte)
>  	if (pte_present(pte)) {
>  		WARN_ON_ONCE(pte_uffd_wp(pte) && pte_write(pte));
>  	} else if (pte_swp_uffd_wp(pte)) {
> -		const swp_entry_t entry = pte_to_swp_entry(pte);
> +		const softleaf_t entry = softleaf_from_pte(pte);
>  
> -		WARN_ON_ONCE(swap_cached_writable(entry));
> +		WARN_ON_ONCE(softleaf_cached_writable(entry));
>  	}
>  }
>  
> @@ -219,9 +219,9 @@ static inline void page_table_check_pmd_flags(pmd_t pmd)
>  		if (pmd_uffd_wp(pmd))
>  			WARN_ON_ONCE(pmd_write(pmd));
>  	} else if (pmd_swp_uffd_wp(pmd)) {
> -		swp_entry_t entry = pmd_to_swp_entry(pmd);
> +		const softleaf_t entry = softleaf_from_pmd(pmd);
>  
> -		WARN_ON_ONCE(swap_cached_writable(entry));
> +		WARN_ON_ONCE(softleaf_cached_writable(entry));
>  	}
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ