[09/15] mm: move pgtable_init() to mm/mm_init.c and make it static

Message ID 20230319220008.2138576-10-rppt@kernel.org
State New
Headers
Series mm: move core MM initialization to mm/mm_init.c |

Commit Message

Mike Rapoport March 19, 2023, 10 p.m. UTC
  From: "Mike Rapoport (IBM)" <rppt@kernel.org>

pgtable_init() is only called from mm_core_init().

Move it close to the caller and make it static.

Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
 include/linux/mm.h | 6 ------
 mm/mm_init.c       | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
  

Comments

David Hildenbrand March 20, 2023, 10:37 a.m. UTC | #1
On 19.03.23 23:00, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> pgtable_init() is only called from mm_core_init().
> 
> Move it close to the caller and make it static.

Why not inline it completely into the single caller? I don't see too 
much value of this indirection.
  

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2d7f095136fc..c3c67d8bc833 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2782,12 +2782,6 @@  static inline bool ptlock_init(struct page *page) { return true; }
 static inline void ptlock_free(struct page *page) {}
 #endif /* USE_SPLIT_PTE_PTLOCKS */
 
-static inline void pgtable_init(void)
-{
-	ptlock_cache_init();
-	pgtable_cache_init();
-}
-
 static inline bool pgtable_pte_page_ctor(struct page *page)
 {
 	if (!ptlock_init(page))
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 1da48762e4a2..a91fbb57c4cc 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -2511,6 +2511,12 @@  void __init memblock_free_pages(struct page *page, unsigned long pfn,
 	__free_pages_core(page, order);
 }
 
+static void __init pgtable_init(void)
+{
+	ptlock_cache_init();
+	pgtable_cache_init();
+}
+
 /* Report memory auto-initialization states for this boot. */
 static void __init report_meminit(void)
 {