Skip to content

Commit 86ec2da

Browse files
Anshuman Khandualtorvalds
authored andcommitted
mm/thp: rename pmd_mknotpresent() as pmd_mkinvalid()
pmd_present() is expected to test positive after pmdp_mknotpresent() as the PMD entry still points to a valid huge page in memory. pmdp_mknotpresent() implies that given PMD entry is just invalidated from MMU perspective while still holding on to pmd_page() referred valid huge page thus also clearing pmd_present() test. This creates the following situation which is counter intuitive. [pmd_present(pmd_mknotpresent(pmd)) = true] This renames pmd_mknotpresent() as pmd_mkinvalid() reflecting the helper's functionality more accurately while changing the above mentioned situation as follows. This does not create any functional change. [pmd_present(pmd_mkinvalid(pmd)) = true] This is not applicable for platforms that define own pmdp_invalidate() via __HAVE_ARCH_PMDP_INVALIDATE. Suggestion for renaming came during a previous discussion here. https://patchwork.kernel.org/patch/11019637/ [anshuman.khandual@arm.com: change pmd_mknotvalid() to pmd_mkinvalid() per Will] Link: http://lkml.kernel.org/r/1587520326-10099-3-git-send-email-anshuman.khandual@arm.com Suggested-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Will Deacon <will@kernel.org> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Paul Mackerras <paulus@samba.org> Link: http://lkml.kernel.org/r/1584680057-13753-3-git-send-email-anshuman.khandual@arm.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 124cb3a commit 86ec2da

7 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎arch/arc/include/asm/hugepage.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static inline pmd_t pte_pmd(pte_t pte)
2626
#define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd)))
2727
#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
2828
#define pmd_mkhuge(pmd) pte_pmd(pte_mkhuge(pmd_pte(pmd)))
29-
#define pmd_mknotpresent(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
29+
#define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
3030
#define pmd_mkclean(pmd) pte_pmd(pte_mkclean(pmd_pte(pmd)))
3131

3232
#define pmd_write(pmd) pte_write(pmd_pte(pmd))

‎arch/arm/include/asm/pgtable-3level.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF);
221221
#define pmdp_establish generic_pmdp_establish
222222

223223
/* represent a notpresent pmd by faulting entry, this is used by pmdp_invalidate */
224-
static inline pmd_t pmd_mknotpresent(pmd_t pmd)
224+
static inline pmd_t pmd_mkinvalid(pmd_t pmd)
225225
{
226226
return __pmd(pmd_val(pmd) & ~L_PMD_SECT_VALID);
227227
}

‎arch/arm64/include/asm/pgtable.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static inline int pmd_protnone(pmd_t pmd)
366366
#define pmd_mkclean(pmd) pte_pmd(pte_mkclean(pmd_pte(pmd)))
367367
#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
368368
#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
369-
#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) & ~PMD_SECT_VALID))
369+
#define pmd_mkinvalid(pmd) (__pmd(pmd_val(pmd) & ~PMD_SECT_VALID))
370370

371371
#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd))
372372

‎arch/mips/include/asm/pgtable.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
631631
return pmd;
632632
}
633633

634-
static inline pmd_t pmd_mknotpresent(pmd_t pmd)
634+
static inline pmd_t pmd_mkinvalid(pmd_t pmd)
635635
{
636636
pmd_val(pmd) &= ~(_PAGE_PRESENT | _PAGE_VALID | _PAGE_DIRTY);
637637

‎arch/x86/include/asm/pgtable.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ static inline pud_t pfn_pud(unsigned long page_nr, pgprot_t pgprot)
624624
return __pud(pfn | check_pgprot(pgprot));
625625
}
626626

627-
static inline pmd_t pmd_mknotpresent(pmd_t pmd)
627+
static inline pmd_t pmd_mkinvalid(pmd_t pmd)
628628
{
629629
return pfn_pmd(pmd_pfn(pmd),
630630
__pgprot(pmd_flags(pmd) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));

‎arch/x86/mm/kmmio.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static void clear_pmd_presence(pmd_t *pmd, bool clear, pmdval_t *old)
130130
pmdval_t v = pmd_val(*pmd);
131131
if (clear) {
132132
*old = v;
133-
new_pmd = pmd_mknotpresent(*pmd);
133+
new_pmd = pmd_mkinvalid(*pmd);
134134
} else {
135135
/* Presume this has been called with clear==true previously */
136136
new_pmd = __pmd(*old);

‎mm/pgtable-generic.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
194194
pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
195195
pmd_t *pmdp)
196196
{
197-
pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mknotpresent(*pmdp));
197+
pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mkinvalid(*pmdp));
198198
flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
199199
return old;
200200
}

0 commit comments

Comments
 (0)