1

mm/mm_init: initialize page->_mapcount directly in __init_single_page()

Let's simply reinitialize the page->_mapcount directly.  We can now get
rid of page_mapcount_reset().

Link: https://lkml.kernel.org/r/20240529111904.2069608-7-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>	[zram/zsmalloc workloads]
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
David Hildenbrand 2024-05-29 13:19:04 +02:00 committed by Andrew Morton
parent 9bf46441ad
commit 11d5401b01
2 changed files with 1 additions and 6 deletions

View File

@ -1210,11 +1210,6 @@ static inline int folio_entire_mapcount(const struct folio *folio)
return atomic_read(&folio->_entire_mapcount) + 1; return atomic_read(&folio->_entire_mapcount) + 1;
} }
static inline void page_mapcount_reset(struct page *page)
{
atomic_set(&(page)->_mapcount, -1);
}
static inline int folio_large_mapcount(const struct folio *folio) static inline int folio_large_mapcount(const struct folio *folio)
{ {
VM_WARN_ON_FOLIO(!folio_test_large(folio), folio); VM_WARN_ON_FOLIO(!folio_test_large(folio), folio);

View File

@ -569,7 +569,7 @@ void __meminit __init_single_page(struct page *page, unsigned long pfn,
mm_zero_struct_page(page); mm_zero_struct_page(page);
set_page_links(page, zone, nid, pfn); set_page_links(page, zone, nid, pfn);
init_page_count(page); init_page_count(page);
page_mapcount_reset(page); atomic_set(&page->_mapcount, -1);
page_cpupid_reset_last(page); page_cpupid_reset_last(page);
page_kasan_tag_reset(page); page_kasan_tag_reset(page);