Skip to content

Commit 7b5ce11

Browse files
Panky-codeskawasaki
authored andcommitted
mm: move huge_zero_page declaration from huge_mm.h to mm.h
Move the declaration associated with huge_zero_page from huge_mm.h to mm.h. This patch is in preparation for adding static PMD zero page as we will be reusing some of the huge_zero_page infrastructure. No functional changes. Signed-off-by: Pankaj Raghav <[email protected]>
1 parent ef2c9cd commit 7b5ce11

2 files changed

Lines changed: 34 additions & 31 deletions

File tree

include/linux/huge_mm.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -478,22 +478,6 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
478478

479479
vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf);
480480

481-
extern struct folio *huge_zero_folio;
482-
extern unsigned long huge_zero_pfn;
483-
484-
static inline bool is_huge_zero_folio(const struct folio *folio)
485-
{
486-
return READ_ONCE(huge_zero_folio) == folio;
487-
}
488-
489-
static inline bool is_huge_zero_pmd(pmd_t pmd)
490-
{
491-
return pmd_present(pmd) && READ_ONCE(huge_zero_pfn) == pmd_pfn(pmd);
492-
}
493-
494-
struct folio *mm_get_huge_zero_folio(struct mm_struct *mm);
495-
void mm_put_huge_zero_folio(struct mm_struct *mm);
496-
497481
static inline bool thp_migration_supported(void)
498482
{
499483
return IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION);
@@ -631,21 +615,6 @@ static inline vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf)
631615
return 0;
632616
}
633617

634-
static inline bool is_huge_zero_folio(const struct folio *folio)
635-
{
636-
return false;
637-
}
638-
639-
static inline bool is_huge_zero_pmd(pmd_t pmd)
640-
{
641-
return false;
642-
}
643-
644-
static inline void mm_put_huge_zero_folio(struct mm_struct *mm)
645-
{
646-
return;
647-
}
648-
649618
static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma,
650619
unsigned long addr, pmd_t *pmd, int flags, struct dev_pagemap **pgmap)
651620
{

include/linux/mm.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4018,6 +4018,40 @@ static inline bool vma_is_special_huge(const struct vm_area_struct *vma)
40184018

40194019
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
40204020

4021+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
4022+
extern struct folio *huge_zero_folio;
4023+
extern unsigned long huge_zero_pfn;
4024+
4025+
static inline bool is_huge_zero_folio(const struct folio *folio)
4026+
{
4027+
return READ_ONCE(huge_zero_folio) == folio;
4028+
}
4029+
4030+
static inline bool is_huge_zero_pmd(pmd_t pmd)
4031+
{
4032+
return pmd_present(pmd) && READ_ONCE(huge_zero_pfn) == pmd_pfn(pmd);
4033+
}
4034+
4035+
struct folio *mm_get_huge_zero_folio(struct mm_struct *mm);
4036+
void mm_put_huge_zero_folio(struct mm_struct *mm);
4037+
4038+
#else
4039+
static inline bool is_huge_zero_folio(const struct folio *folio)
4040+
{
4041+
return false;
4042+
}
4043+
4044+
static inline bool is_huge_zero_pmd(pmd_t pmd)
4045+
{
4046+
return false;
4047+
}
4048+
4049+
static inline void mm_put_huge_zero_folio(struct mm_struct *mm)
4050+
{
4051+
return;
4052+
}
4053+
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
4054+
40214055
#if MAX_NUMNODES > 1
40224056
void __init setup_nr_node_ids(void);
40234057
#else

0 commit comments

Comments
 (0)