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: <9af55241-8348-46a1-8f72-5ad7e61bcd84@redhat.com>
Date: Tue, 1 Jul 2025 14:36:17 +0200
From: David Hildenbrand <david@...hat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.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>,
 Zi Yan <ziy@...dia.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>,
 "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 v1 18/29] mm: remove __folio_test_movable()

>> ---
>>   include/linux/page-flags.h |  6 ------
>>   mm/migrate.c               | 43 ++++++++++++--------------------------
>>   mm/vmscan.c                |  6 ++++--
>>   3 files changed, 17 insertions(+), 38 deletions(-)
>>
>> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
>> index c67163b73c5ec..4c27ebb689e3c 100644
>> --- a/include/linux/page-flags.h
>> +++ b/include/linux/page-flags.h
>> @@ -744,12 +744,6 @@ static __always_inline bool PageAnon(const struct page *page)
>>   	return folio_test_anon(page_folio(page));
>>   }
>>
>> -static __always_inline bool __folio_test_movable(const struct folio *folio)
>> -{
>> -	return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) ==
>> -			PAGE_MAPPING_MOVABLE;
>> -}
>> -
> 
> Woah, wait, does this mean we can remove PAGE_MAPPING_MOVABLE??

Jup :)

> 
> Nice!
> 
>>   static __always_inline bool page_has_movable_ops(const struct page *page)
>>   {
>>   	return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index 587af35b7390d..15d3c1031530c 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -219,12 +219,7 @@ void putback_movable_pages(struct list_head *l)
>>   			continue;
>>   		}
>>   		list_del(&folio->lru);
>> -		/*
>> -		 * We isolated non-lru movable folio so here we can use
>> -		 * __folio_test_movable because LRU folio's mapping cannot
>> -		 * have PAGE_MAPPING_MOVABLE.
>> -		 */
> 
> So hate these references to 'LRU' as in meaning 'pages that could be on the
> LRU'.

Yeah, it's a historical thing.

But for anything we isolated, it had to be an LRU folio (PageLRU) 
because that's how we were even able to isolate it ... from the LRU.

[...]

>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 098bcc821fc74..103dfc729a823 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1658,9 +1658,11 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone,
>>   	unsigned int noreclaim_flag;
>>
>>   	list_for_each_entry_safe(folio, next, folio_list, lru) {
>> +		/* TODO: these pages should not even appear in this list. */
>> +		if (page_has_movable_ops(&folio->page))
> 
> VM_WARN_ON_ONCE()?

Well, no, it can currently still happen. But really, movable_ops pages 
are not folios that could ever be reclaimed that way.

So the TODO highlights that movable_ops pages should never even be put 
in a list (page->lru will go away).

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ