Skip to content

Commit 9ff3d05

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 ef18525 commit 9ff3d05

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
@@ -4024,6 +4024,40 @@ static inline bool vma_is_special_huge(const struct vm_area_struct *vma)
40244024

40254025
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
40264026

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

0 commit comments

Comments
 (0)