]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/page_alloc: clear PageBuddy using __ClearPageBuddy() for bad pages
authorDavid Hildenbrand <david@redhat.com>
Wed, 29 May 2024 11:19:02 +0000 (13:19 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:17 +0000 (19:30 -0700)
Let's stop using page_mapcount_reset() and clear PageBuddy using
__ClearPageBuddy() instead.

Link: https://lkml.kernel.org/r/20240529111904.2069608-5-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>
mm/page_alloc.c

index 0576ac081a1fe45b488dc6ddd4cd4dce7ddf2291..8d7b4424b6453ef09b1baec9b179b66b549cef8c 100644 (file)
@@ -498,7 +498,8 @@ static void bad_page(struct page *page, const char *reason)
        dump_stack();
 out:
        /* Leave bad fields for debug, except PageBuddy could make trouble */
-       page_mapcount_reset(page); /* remove PageBuddy */
+       if (PageBuddy(page))
+               __ClearPageBuddy(page);
        add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
 }
 
@@ -1351,7 +1352,8 @@ static void check_new_page_bad(struct page *page)
 {
        if (unlikely(page->flags & __PG_HWPOISON)) {
                /* Don't complain about hwpoisoned pages */
-               page_mapcount_reset(page); /* remove PageBuddy */
+               if (PageBuddy(page))
+                       __ClearPageBuddy(page);
                return;
        }