Skip to contentSkip to conversation

mm/page_table_check: Drop all redundant EXPORT_SYMBOL()

PATCH Superseded Anshuman Khandual 3 participants 5 messages Apr 20, 2022 – Apr 21, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/page_table_check: Drop all redundant EXPORT_SYMBOL()

Function definitions need not be exported via EXPORT_SYMBOL() mechanism. In this case these functions just get called only inside their wrappers. Even __page_table_check_zero() gets called without such an export. Just drop all these redundant EXPORT_SYMBOL().

---
This applies on v5.18-rc3

 mm/page_table_check.c | 6 ------
 1 file changed, 6 deletions(-)
mm/page_table_check.c +0 -6
index 2458281bff89..5c2a96159832 100644
@@ -167,7 +167,6 @@ void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr,
 				       PAGE_SIZE >> PAGE_SHIFT);
 	}
 }
-EXPORT_SYMBOL(__page_table_check_pte_clear);
 
 void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr,
 				  pmd_t pmd)
@@ -180,7 +179,6 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr,
 				       PMD_PAGE_SIZE >> PAGE_SHIFT);
 	}
 }
-EXPORT_SYMBOL(__page_table_check_pmd_clear);
 
 void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
 				  pud_t pud)
@@ -193,7 +191,6 @@ void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
 				       PUD_PAGE_SIZE >> PAGE_SHIFT);
 	}
 }
-EXPORT_SYMBOL(__page_table_check_pud_clear);
 
 void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr,
 				pte_t *ptep, pte_t pte)
@@ -208,7 +205,6 @@ void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr,
 				     pte_write(pte));
 	}
 }
-EXPORT_SYMBOL(__page_table_check_pte_set);
 
 void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr,
 				pmd_t *pmdp, pmd_t pmd)
@@ -223,7 +219,6 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr,
 				     pmd_write(pmd));
 	}
 }
-EXPORT_SYMBOL(__page_table_check_pmd_set);
 
 void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr,
 				pud_t *pudp, pud_t pud)
@@ -238,7 +233,6 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr,
 				     pud_write(pud));
 	}
 }
-EXPORT_SYMBOL(__page_table_check_pud_set);
 
 void __page_table_check_pte_clear_range(struct mm_struct *mm,
 					unsigned long addr,
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 46 lines · Anshuman Khandual

Function definitions need not be exported via EXPORT_SYMBOL() mechanism. In this case these functions just get called only inside their wrappers. Even __page_table_check_zero() gets called without such an export. Just drop all these redundant EXPORT_SYMBOL().

---
This applies on v5.18-rc3

 mm/page_table_check.c | 6 ------
 1 file changed, 6 deletions(-)
mm/page_table_check.c +0 -3
index 2458281bff89..5c2a96159832 100644
@@ -167,7 +167,6 @@ void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr,
                                       PAGE_SIZE >> PAGE_SHIFT);
        }
 }
-EXPORT_SYMBOL(__page_table_check_pte_clear);
 
 void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr,
                                  pmd_t pmd)
@@ -180,7 +179,6 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr,
                                       PMD_PAGE_SIZE >> PAGE_SHIFT);
        }
 }
-EXPORT_SYMBOL(__page_table_check_pmd_clear);
 
 void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
                                  pud_t pud)
@@ -193,7 +191,6 @@ void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
                                       PUD_PAGE_SIZE >> PAGE_SHIFT);
        }
 }
-EXPORT_SYMBOL(__page_table_check_pud_clear);
 
 void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr,
                                pte_t *ptep, pte_t pte)

mm/page_table_check.c void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr, · line 211

Quoted 4 lines
mm/page_table_check.c +0 -1
@@ -208,7 +205,6 @@ void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr,
                                     pte_write(pte));
        }
 }
-EXPORT_SYMBOL(__page_table_check_pte_set);

Hi Anshuman,

See this:
https://lore.kernel.org/all/20211124234754.l5co34dUK%[email protected]/

The rest of EXPORTs were added to be symmetric, and allow other drivers to use set_*p**()/clear_p** calls.

Pasha

#2 lore raw
Quoted 2 lines · Pasha Tatashin

The rest of EXPORTs were added to be symmetric, and allow other drivers to use set_*p**()/clear_p** calls.

EXPORT_SYMBOLs actually have a real cost. We don't add them "for symmetry".

maintainer
#3 lore raw
Quoted 7 lines · Matthew Wilcox
Quoted 2 lines · Pasha Tatashin

The rest of EXPORTs were added to be symmetric, and allow other drivers to use set_*p**()/clear_p** calls.

EXPORT_SYMBOLs actually have a real cost. We don't add them "for symmetry".

Sure, the rest of exports can be removed, but:

Quoted 1 line

-EXPORT_SYMBOL(__page_table_check_pte_set);

must stay because of

ERROR: modpost: "__page_table_check_pte_set"
[drivers/gpu/drm/i915/i915.ko] undefined!

Pasha

#4 lore raw
Quoted 9 lines · Pasha Tatashin
Quoted 7 lines · Matthew Wilcox
Quoted 2 lines · Pasha Tatashin

The rest of EXPORTs were added to be symmetric, and allow other drivers to use set_*p**()/clear_p** calls.

EXPORT_SYMBOLs actually have a real cost. We don't add them "for symmetry".

Quoted 8 lines

Sure, the rest of exports can be removed, but:

Quoted 1 line

-EXPORT_SYMBOL(__page_table_check_pte_set);

must stay because of

ERROR: modpost: "__page_table_check_pte_set"
[drivers/gpu/drm/i915/i915.ko] undefined!

Sure, will resend.