diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-09-02 20:45:59 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-10-03 14:02:44 -0700 |
commit | c3a15bff46cb5149aeae4c8ae69443d791fa6578 (patch) | |
tree | c19fc91cfc9daf06572af7b2950b573ec10bc3fd /include | |
parent | 379708ffde1b049bc41084e0a0572c44c8a1d2c4 (diff) | |
download | linux-stable-c3a15bff46cb5149aeae4c8ae69443d791fa6578.tar.gz linux-stable-c3a15bff46cb5149aeae4c8ae69443d791fa6578.tar.bz2 linux-stable-c3a15bff46cb5149aeae4c8ae69443d791fa6578.zip |
mm: reimplement folio_order() and folio_nr_pages()
Instead of calling compound_order() and compound_nr_pages(), use the folio
directly. Saves 1905 bytes from mm/filemap.o due to folio_test_large()
now being a cheaper check than PageHead().
Link: https://lkml.kernel.org/r/20220902194653.1739778-4-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mm.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index e56dd8f7eae1..a37c8a29c49b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -729,7 +729,9 @@ static inline unsigned int compound_order(struct page *page) */ static inline unsigned int folio_order(struct folio *folio) { - return compound_order(&folio->page); + if (!folio_test_large(folio)) + return 0; + return folio->_folio_order; } #include <linux/huge_mm.h> @@ -1659,7 +1661,13 @@ static inline void set_page_links(struct page *page, enum zone_type zone, */ static inline long folio_nr_pages(struct folio *folio) { - return compound_nr(&folio->page); + if (!folio_test_large(folio)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << folio->_folio_order; +#endif } /** |