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: <d6208fab-9ab5-485e-9cc3-94256fef2e1b@redhat.com>
Date: Mon, 23 Jun 2025 17:47:26 +0200
From: David Hildenbrand <david@...hat.com>
To: Zi Yan <ziy@...dia.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
 linux-doc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
 virtualization@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
 Andrew Morton <akpm@...ux-foundation.org>, Jonathan Corbet <corbet@....net>,
 Madhavan Srinivasan <maddy@...ux.ibm.com>,
 Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
 Christophe Leroy <christophe.leroy@...roup.eu>,
 Jerrin Shaji George <jerrin.shaji-george@...adcom.com>,
 Arnd Bergmann <arnd@...db.de>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
 Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
 <eperezma@...hat.com>, Alexander Viro <viro@...iv.linux.org.uk>,
 Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
 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>,
 Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 "Liam R. Howlett" <Liam.Howlett@...cle.com>, Vlastimil Babka
 <vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
 Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
 "Matthew Wilcox (Oracle)" <willy@...radead.org>,
 Minchan Kim <minchan@...nel.org>,
 Sergey Senozhatsky <senozhatsky@...omium.org>,
 Brendan Jackman <jackmanb@...gle.com>, Johannes Weiner <hannes@...xchg.org>,
 Jason Gunthorpe <jgg@...pe.ca>, John Hubbard <jhubbard@...dia.com>,
 Peter Xu <peterx@...hat.com>, Xu Xin <xu.xin16@....com.cn>,
 Chengming Zhou <chengming.zhou@...ux.dev>, Miaohe Lin
 <linmiaohe@...wei.com>, Naoya Horiguchi <nao.horiguchi@...il.com>,
 Oscar Salvador <osalvador@...e.de>, Rik van Riel <riel@...riel.com>,
 Harry Yoo <harry.yoo@...cle.com>, Qi Zheng <zhengqi.arch@...edance.com>,
 Shakeel Butt <shakeel.butt@...ux.dev>
Subject: Re: [PATCH RFC 16/29] mm: rename __PageMovable() to
 page_has_movable_ops()

On 20.06.25 22:37, Zi Yan wrote:
> On 18 Jun 2025, at 13:39, David Hildenbrand wrote:
> 
>> Let's make it clearer that we are talking about movable_ops pages.
>>
>> Signed-off-by: David Hildenbrand <david@...hat.com>
>> ---
>>   include/linux/migrate.h    |  2 +-
>>   include/linux/page-flags.h |  2 +-
>>   mm/compaction.c            |  7 ++-----
>>   mm/memory-failure.c        |  4 ++--
>>   mm/memory_hotplug.c        |  8 +++-----
>>   mm/migrate.c               |  8 ++++----
>>   mm/page_alloc.c            |  2 +-
>>   mm/page_isolation.c        | 10 +++++-----
>>   8 files changed, 19 insertions(+), 24 deletions(-)
>>
>> diff --git a/include/linux/migrate.h b/include/linux/migrate.h
>> index 204e89eac998f..c575778456f97 100644
>> --- a/include/linux/migrate.h
>> +++ b/include/linux/migrate.h
>> @@ -115,7 +115,7 @@ static inline void __SetPageMovable(struct page *page,
>>   static inline
>>   const struct movable_operations *page_movable_ops(struct page *page)
>>   {
>> -	VM_BUG_ON(!__PageMovable(page));
>> +	VM_BUG_ON(!page_has_movable_ops(page));
>>
>>   	return (const struct movable_operations *)
>>   		((unsigned long)page->mapping - PAGE_MAPPING_MOVABLE);
>> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
>> index 4fe5ee67535b2..c67163b73c5ec 100644
>> --- a/include/linux/page-flags.h
>> +++ b/include/linux/page-flags.h
>> @@ -750,7 +750,7 @@ static __always_inline bool __folio_test_movable(const struct folio *folio)
>>   			PAGE_MAPPING_MOVABLE;
>>   }
>>
>> -static __always_inline bool __PageMovable(const struct page *page)
>> +static __always_inline bool page_has_movable_ops(const struct page *page)
>>   {
>>   	return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
>>   				PAGE_MAPPING_MOVABLE;
>> diff --git a/mm/compaction.c b/mm/compaction.c
>> index 5c37373017014..f8b7c09e2e48c 100644
>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -1056,11 +1056,8 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>>   		 * Skip any other type of page
>>   		 */
>>   		if (!PageLRU(page)) {
>> -			/*
>> -			 * __PageMovable can return false positive so we need
>> -			 * to verify it under page_lock.
>> -			 */
>> -			if (unlikely(__PageMovable(page)) &&
>> +			/* Isolation will grab the page lock. */
> 
> I feel that the removed comment should stay, since the current comment
> makes no sense when I read it alone.

Well, talking about the page lock is moot either way. The thing is, 
anything can change while we don't hold a page reference. So should we 
change the comment to

/* isolation code will deal with any races. */

... or drop it completely?

> 
> In addition, why is __PageMovable() is renamed to page_has_movable_ops() but
> __SetPageMovable() stays the same? page_has_movable_ops() and __SetPageMovable()
> are functions for checking and setting PAGE_MAPPING_MOVABLE. The naming just
> does not look symmetric.

See follow-up commits where __SetPageMovable() is cleaned up.

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ