diff options
author | Ingo Molnar <mingo@kernel.org> | 2021-12-06 09:38:52 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2022-03-15 12:57:31 +0100 |
commit | b7206480c9f86297ff76f843ea47bcfc02671e2e (patch) | |
tree | b6d1c73d51c43f207c37bb4ef63be5303d6a2851 | |
parent | d401dfa7d5640cfd1ff8482db724d4e0c204fbfc (diff) | |
download | tip-b7206480c9f86297ff76f843ea47bcfc02671e2e.tar.gz |
headers/deps: mm/sparsemem: Move the set_page_section() and page_to_section() definitions from <linux/mm_api.h> to <linux/mmzone_api.h>
The sparsemem part of <asm-generic/memory_model.h> is a mess: it relies on
various methods from very high level MM headers such as <linux/mm_api.h>,
yet it's a low level header that gets included in x86's <asm/page.h>.
Clean this up some more by moving over the page_to_section() method
from <linux/mm_api.h> from <linux/mmzone_api.h> - this is now safe
after recent cleanups.
We'll change <asm-generic/memory_model.h> in a separate patch.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/mm_api.h | 19 | ||||
-rw-r--r-- | include/linux/mmzone_api.h | 19 |
2 files changed, 19 insertions, 19 deletions
diff --git a/include/linux/mm_api.h b/include/linux/mm_api.h index f7d6178ea6e039..006dea6a574071 100644 --- a/include/linux/mm_api.h +++ b/include/linux/mm_api.h @@ -853,10 +853,6 @@ static inline bool is_cow_mapping(vm_flags_t flags) return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; } -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -#define SECTION_IN_PAGE_FLAGS -#endif - /* * The identification function is mainly used by the buddy allocator for * determining if two pages could be buddies. We are not really identifying @@ -1011,21 +1007,6 @@ static inline pg_data_t *folio_pgdat(const struct folio *folio) return page_pgdat(&folio->page); } -#ifdef SECTION_IN_PAGE_FLAGS -#ifndef BUILD_VDSO32_64 -static inline void set_page_section(struct page *page, unsigned long section) -{ - page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); - page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; -} - -static inline unsigned long page_to_section(const struct page *page) -{ - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; -} -#endif -#endif - /** * folio_pfn - Return the Page Frame Number of a folio. * @folio: The folio. diff --git a/include/linux/mmzone_api.h b/include/linux/mmzone_api.h index 862fef5634f0a8..2b95254cc0b891 100644 --- a/include/linux/mmzone_api.h +++ b/include/linux/mmzone_api.h @@ -749,6 +749,25 @@ void sparse_init(void); #define subsection_map_init(_pfn, _nr_pages) do {} while (0) #endif /* CONFIG_SPARSEMEM */ +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define SECTION_IN_PAGE_FLAGS +#endif + +#ifdef SECTION_IN_PAGE_FLAGS +#ifndef BUILD_VDSO32_64 +static inline void set_page_section(struct page *page, unsigned long section) +{ + page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); + page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; +} + +static inline unsigned long page_to_section(const struct page *page) +{ + return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; +} +#endif +#endif + #endif /* !__GENERATING_BOUNDS.H */ #endif /* !__ASSEMBLY__ */ |