summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-03-26 18:10:27 +0100
committerAndrew Morton <akpm@linux-foundation.org>2024-04-26 05:56:14 +0200
commit2ace5a670e2a0f3a6029bc6cf91dc14202074e7a (patch)
tree50c7259f1a8317e101a3e5194cff98ccfc7462fd /mm/page_alloc.c
parentmm: make folio_test_idle and folio_test_young take a const argument (diff)
downloadlinux-2ace5a670e2a0f3a6029bc6cf91dc14202074e7a.tar.xz
linux-2ace5a670e2a0f3a6029bc6cf91dc14202074e7a.zip
mm: make is_free_buddy_page() take a const argument
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>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index daab8cab91cc..6a8593aef297 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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;
}