Skip to contentSkip to conversation

mm/huge_memory: make is_transparent_hugepage() static

PATCH Applied Miaohe Lin 3 participants 3 messages Mar 2, 2022

Subsystems (2)
lore
Share & tools
lore

Miaohe Lin

author
#0 lore raw

PATCH 1/1 mm/huge_memory: make is_transparent_hugepage() static

It's only used inside the huge_memory.c now. Don't export it and make it static. We can thus reduce the size of huge_memory.o a bit.

Without this patch:
text data bss dec hex filename
32319 2965 4 35288 89d8 mm/huge_memory.o

With this patch:
text data bss dec hex filename
32042 2957 4 35003 88bb mm/huge_memory.o

---
 include/linux/huge_mm.h | 6 ------
 mm/huge_memory.c        | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)
include/linux/huge_mm.h +0 -6
index 0734aff8fa19..2999190adc22 100644
@@ -183,7 +183,6 @@ unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
 
 void prep_transhuge_page(struct page *page);
 void free_transhuge_page(struct page *page);
-bool is_transparent_hugepage(struct page *page);
 
 bool can_split_folio(struct folio *folio, int *pextra_pins);
 int split_huge_page_to_list(struct page *page, struct list_head *list);
@@ -341,11 +340,6 @@ static inline bool transhuge_vma_enabled(struct vm_area_struct *vma,
 
 static inline void prep_transhuge_page(struct page *page) {}
 
-static inline bool is_transparent_hugepage(struct page *page)
-{
-	return false;
-}
-
 #define transparent_hugepage_flags 0UL
 
 #define thp_get_unmapped_area	NULL
mm/huge_memory.c +1 -2
index b49e1a11df2e..592588825c07 100644
@@ -533,7 +533,7 @@ void prep_transhuge_page(struct page *page)
 	set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR);
 }
 
-bool is_transparent_hugepage(struct page *page)
+static inline bool is_transparent_hugepage(struct page *page)
 {
 	if (!PageCompound(page))
 		return false;
@@ -542,7 +542,6 @@ bool is_transparent_hugepage(struct page *page)
 	return is_huge_zero_page(page) ||
 	       page[1].compound_dtor == TRANSHUGE_PAGE_DTOR;
 }
-EXPORT_SYMBOL_GPL(is_transparent_hugepage);
 
 static unsigned long __thp_get_unmapped_area(struct file *filp,
 		unsigned long addr, unsigned long len,
Signature · 1 line
2.23.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Miaohe Lin

It's only used inside the huge_memory.c now. Don't export it and make it static. We can thus reduce the size of huge_memory.o a bit.

Without this patch:
text data bss dec hex filename
32319 2965 4 35288 89d8 mm/huge_memory.o

Quoted 5 lines

With this patch:
text data bss dec hex filename
32042 2957 4 35003 88bb mm/huge_memory.o

Thanks.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Miaohe Lin
Quoted 8 lines · Miaohe Lin

It's only used inside the huge_memory.c now. Don't export it and make it static. We can thus reduce the size of huge_memory.o a bit.

Without this patch:
text data bss dec hex filename
32319 2965 4 35288 89d8 mm/huge_memory.o

Quoted 5 lines

With this patch:
text data bss dec hex filename
32042 2957 4 35003 88bb mm/huge_memory.o

Quoted 53 lines
---
 include/linux/huge_mm.h | 6 ------
 mm/huge_memory.c        | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)
include/linux/huge_mm.h +0 -6
index 0734aff8fa19..2999190adc22 100644
@@ -183,7 +183,6 @@ unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
 
 void prep_transhuge_page(struct page *page);
 void free_transhuge_page(struct page *page);
-bool is_transparent_hugepage(struct page *page);
 
 bool can_split_folio(struct folio *folio, int *pextra_pins);
 int split_huge_page_to_list(struct page *page, struct list_head *list);
@@ -341,11 +340,6 @@ static inline bool transhuge_vma_enabled(struct vm_area_struct *vma,
 
 static inline void prep_transhuge_page(struct page *page) {}
 
-static inline bool is_transparent_hugepage(struct page *page)
-{
-       return false;
-}
-
 #define transparent_hugepage_flags 0UL
 
 #define thp_get_unmapped_area  NULL
mm/huge_memory.c +1 -3
index b49e1a11df2e..592588825c07 100644
@@ -533,7 +533,7 @@ void prep_transhuge_page(struct page *page)
        set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR);
 }
 
-bool is_transparent_hugepage(struct page *page)
+static inline bool is_transparent_hugepage(struct page *page)
 {
        if (!PageCompound(page))
                return false;
@@ -542,7 +542,6 @@ bool is_transparent_hugepage(struct page *page)
        return is_huge_zero_page(page) ||
               page[1].compound_dtor == TRANSHUGE_PAGE_DTOR;
 }
-EXPORT_SYMBOL_GPL(is_transparent_hugepage);
 
 static unsigned long __thp_get_unmapped_area(struct file *filp,
                unsigned long addr, unsigned long len,
--

2.23.0