From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 05/10] mm: Make is_free_buddy_page() take a const argument
Date: Tue, 26 Mar 2024 17:10:27 +0000 [thread overview]
Message-ID: <20240326171045.410737-6-willy@infradead.org> (raw)
In-Reply-To: <20240326171045.410737-1-willy@infradead.org>
This function does not modify its argument; let the callers know that
so they can make better optimisation decisions.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 2 +-
mm/page_alloc.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 0163d6da6283..eaecf544039f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -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);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 370ea1711828..a00a2d7d8d9f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6786,16 +6786,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;
}
--
2.43.0
next prev parent reply other threads:[~2024-03-26 17:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-26 17:10 [PATCH 00/10] Various page->flags cleanups Matthew Wilcox (Oracle)
2024-03-26 17:10 ` [PATCH 01/10] sh: Remove use of PG_arch_1 on individual pages Matthew Wilcox (Oracle)
2024-03-27 18:45 ` kernel test robot
2024-03-27 18:49 ` Matthew Wilcox
2024-03-26 17:10 ` [PATCH 02/10] xtensa: Remove uses " Matthew Wilcox (Oracle)
2024-03-28 19:36 ` Svetly Todorov
2024-03-28 19:40 ` Matthew Wilcox
2024-03-26 17:10 ` [PATCH 03/10] mm: Make page_ext_get() take a const argument Matthew Wilcox (Oracle)
2024-03-26 17:10 ` [PATCH 04/10] mm: Make folio_test_idle and folio_test_young " Matthew Wilcox (Oracle)
2024-03-26 17:10 ` Matthew Wilcox (Oracle) [this message]
2024-03-26 17:10 ` [PATCH 06/10] mm: Make page_mapped() " Matthew Wilcox (Oracle)
2024-03-26 17:10 ` [PATCH 07/10] mm: Convert arch_clear_hugepage_flags to take a folio Matthew Wilcox (Oracle)
2024-03-27 13:02 ` Ryan Roberts
2024-03-27 14:37 ` Matthew Wilcox
2024-03-27 15:48 ` kernel test robot
2024-03-27 17:01 ` kernel test robot
2024-03-26 17:10 ` [PATCH 08/10] slub: Remove use of page->flags Matthew Wilcox (Oracle)
2024-04-04 18:29 ` David Hildenbrand
2024-03-26 17:10 ` [PATCH 09/10] Remove references to page->flags in documentation Matthew Wilcox (Oracle)
2024-03-26 17:10 ` [PATCH 10/10] proc: Rewrite stable_page_flags() Matthew Wilcox (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240326171045.410737-6-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).