mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 19:21:28 +02:00
mm: constify compound_order() and page_size()
Patch series "Small cleanups". These small cleanups can be applied now to reduce conflicts during the next merge window. They're all from various efforts to split struct page from other memdescs. Thanks to Vlastimil for the suggestion. This patch (of 3): These functions do not modify their arguments. Telling the compiler this may improve code generation, and allows us to pass const arguments from other functions. Link: https://lkml.kernel.org/r/20250910142923.2465470-1-willy@infradead.org Link: https://lkml.kernel.org/r/20250910142923.2465470-2-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Zi Yan <ziy@nvidia.com> Acked-by: David Hildenbrand <david@redhat.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
b33939383b
commit
3a37469e5a
|
|
@ -1036,9 +1036,9 @@ static inline unsigned long folio_large_nr_pages(const struct folio *folio)
|
|||
* set before the order is initialised, or this may be a tail page.
|
||||
* See compaction.c for some good examples.
|
||||
*/
|
||||
static inline unsigned int compound_order(struct page *page)
|
||||
static inline unsigned int compound_order(const struct page *page)
|
||||
{
|
||||
struct folio *folio = (struct folio *)page;
|
||||
const struct folio *folio = (struct folio *)page;
|
||||
|
||||
if (!test_bit(PG_head, &folio->flags.f))
|
||||
return 0;
|
||||
|
|
@ -1256,7 +1256,7 @@ int folio_mc_copy(struct folio *dst, struct folio *src);
|
|||
unsigned long nr_free_buffer_pages(void);
|
||||
|
||||
/* Returns the number of bytes in this potentially compound page. */
|
||||
static inline unsigned long page_size(struct page *page)
|
||||
static inline unsigned long page_size(const struct page *page)
|
||||
{
|
||||
return PAGE_SIZE << compound_order(page);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user