]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: make is_free_buddy_page() take a const argument
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 26 Mar 2024 17:10:27 +0000 (17:10 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Apr 2024 03:56:14 +0000 (20:56 -0700)
This function does not modify its argument; let the callers know that so
they can make better optimisation decisions.

Link: https://lkml.kernel.org/r/20240326171045.410737-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/page-flags.h
mm/page_alloc.c

index 0163d6da6283cc143797acea94af1edbdabae558..eaecf544039fecb4c40d4512cf08ecbcb972f732 100644 (file)
@@ -1088,7 +1088,7 @@ static inline bool is_page_hwpoison(const struct page *page)
        return folio_test_hugetlb(folio) && PageHWPoison(&folio->page);
 }
 
-extern bool is_free_buddy_page(struct page *page);
+bool is_free_buddy_page(const struct page *page);
 
 PAGEFLAG(Isolated, isolated, PF_ANY);
 
index daab8cab91ccf29ab59bd04195c3d439d4b961d1..6a8593aef297769e8e15ee969097b45e39a9d679 100644 (file)
@@ -6745,16 +6745,16 @@ void __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
 /*
  * This function returns a stable result only if called under zone lock.
  */
-bool is_free_buddy_page(struct page *page)
+bool is_free_buddy_page(const struct page *page)
 {
        unsigned long pfn = page_to_pfn(page);
        unsigned int order;
 
        for (order = 0; order < NR_PAGE_ORDERS; order++) {
-               struct page *page_head = page - (pfn & ((1 << order) - 1));
+               const struct page *head = page - (pfn & ((1 << order) - 1));
 
-               if (PageBuddy(page_head) &&
-                   buddy_order_unsafe(page_head) >= order)
+               if (PageBuddy(head) &&
+                   buddy_order_unsafe(head) >= order)
                        break;
        }