linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
@ 2020-03-20  4:54 Anshuman Khandual
  2020-03-20  4:54 ` [PATCH 1/2] powerpc/mm: Drop platform defined pmd_mknotpresent() Anshuman Khandual
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Anshuman Khandual @ 2020-03-20  4:54 UTC (permalink / raw)
  To: linux-mm
  Cc: Anshuman Khandual, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras, Vineet Gupta, Russell King, Catalin Marinas,
	Will Deacon, Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Andrew Morton, nouveau,
	linuxppc-dev, linux-snps-arc, linux-arm-kernel, linux-mips, x86,
	linux-kernel

This series renames pmd_mknotpresent() as pmd_mknotvalid(). Before that it
drops an existing pmd_mknotpresent() definition from powerpc platform which
was never required as it defines it's pmdp_invalidate() through subscribing
__HAVE_ARCH_PMDP_INVALIDATE. This does not create any functional change.

This rename was suggested by Catalin during a previous discussion while we
were trying to change the THP helpers on arm64 platform for migration.

https://patchwork.kernel.org/patch/11019637/

This series is based on v5.6-rc6.

Boot tested on arm64 and x86 platforms.
Built tested on many other platforms including the ones changed here.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
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: Andrew Morton <akpm@linux-foundation.org>
Cc: nouveau@lists.freedesktop.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org

Anshuman Khandual (2):
  powerpc/mm: Drop platform defined pmd_mknotpresent()
  mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()

 arch/arc/include/asm/hugepage.h              | 2 +-
 arch/arm/include/asm/pgtable-3level.h        | 2 +-
 arch/arm64/include/asm/pgtable.h             | 2 +-
 arch/mips/include/asm/pgtable.h              | 2 +-
 arch/powerpc/include/asm/book3s/64/pgtable.h | 4 ----
 arch/x86/include/asm/pgtable.h               | 2 +-
 arch/x86/mm/kmmio.c                          | 2 +-
 mm/pgtable-generic.c                         | 2 +-
 8 files changed, 7 insertions(+), 11 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] powerpc/mm: Drop platform defined pmd_mknotpresent()
  2020-03-20  4:54 [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
@ 2020-03-20  4:54 ` Anshuman Khandual
  2020-03-20  4:54 ` [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
  2020-03-29 13:42 ` [PATCH 0/2] " Anshuman Khandual
  2 siblings, 0 replies; 9+ messages in thread
From: Anshuman Khandual @ 2020-03-20  4:54 UTC (permalink / raw)
  To: linux-mm
  Cc: Anshuman Khandual, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras, linuxppc-dev, linux-kernel

Platform needs to define pmd_mknotpresent() for generic pmdp_invalidate()
only when __HAVE_ARCH_PMDP_INVALIDATE is not subscribed. Otherwise platform
specific pmd_mknotpresent() is not required. Hence just drop it.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/powerpc/include/asm/book3s/64/pgtable.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 201a69e6a355..5d4bc19c2a3c 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -1168,10 +1168,6 @@ static inline int pmd_large(pmd_t pmd)
 	return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
 }
 
-static inline pmd_t pmd_mknotpresent(pmd_t pmd)
-{
-	return __pmd(pmd_val(pmd) & ~_PAGE_PRESENT);
-}
 /*
  * For radix we should always find H_PAGE_HASHPTE zero. Hence
  * the below will work for radix too
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
  2020-03-20  4:54 [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
  2020-03-20  4:54 ` [PATCH 1/2] powerpc/mm: Drop platform defined pmd_mknotpresent() Anshuman Khandual
@ 2020-03-20  4:54 ` Anshuman Khandual
  2020-04-20 21:03   ` Will Deacon
  2020-03-29 13:42 ` [PATCH 0/2] " Anshuman Khandual
  2 siblings, 1 reply; 9+ messages in thread
From: Anshuman Khandual @ 2020-03-20  4:54 UTC (permalink / raw)
  To: linux-mm
  Cc: Anshuman Khandual, Vineet Gupta, Russell King, Catalin Marinas,
	Will Deacon, Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Andrew Morton, nouveau,
	linux-snps-arc, linux-arm-kernel, linux-mips, x86, linux-kernel

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_mknotvalid() 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_mknotvalid(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/

Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
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: Andrew Morton <akpm@linux-foundation.org>
Cc: nouveau@lists.freedesktop.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org

Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arc/include/asm/hugepage.h       | 2 +-
 arch/arm/include/asm/pgtable-3level.h | 2 +-
 arch/arm64/include/asm/pgtable.h      | 2 +-
 arch/mips/include/asm/pgtable.h       | 2 +-
 arch/x86/include/asm/pgtable.h        | 2 +-
 arch/x86/mm/kmmio.c                   | 2 +-
 mm/pgtable-generic.c                  | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arc/include/asm/hugepage.h b/arch/arc/include/asm/hugepage.h
index 30ac40fed2c5..98d56267050f 100644
--- a/arch/arc/include/asm/hugepage.h
+++ b/arch/arc/include/asm/hugepage.h
@@ -26,7 +26,7 @@ static inline pmd_t pte_pmd(pte_t pte)
 #define pmd_mkold(pmd)		pte_pmd(pte_mkold(pmd_pte(pmd)))
 #define pmd_mkyoung(pmd)	pte_pmd(pte_mkyoung(pmd_pte(pmd)))
 #define pmd_mkhuge(pmd)		pte_pmd(pte_mkhuge(pmd_pte(pmd)))
-#define pmd_mknotpresent(pmd)	pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
+#define pmd_mknotvalid(pmd)	pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
 #define pmd_mkclean(pmd)	pte_pmd(pte_mkclean(pmd_pte(pmd)))
 
 #define pmd_write(pmd)		pte_write(pmd_pte(pmd))
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index ad55ab068dbf..2943cdf2828b 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -241,7 +241,7 @@ PMD_BIT_FUNC(mkyoung,   |= PMD_SECT_AF);
 #define pmdp_establish generic_pmdp_establish
 
 /* represent a notpresent pmd by faulting entry, this is used by pmdp_invalidate */
-static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+static inline pmd_t pmd_mknotvalid(pmd_t pmd)
 {
 	return __pmd(pmd_val(pmd) & ~L_PMD_SECT_VALID);
 }
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 538c85e62f86..28cdd97578a5 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -366,7 +366,7 @@ static inline int pmd_protnone(pmd_t pmd)
 #define pmd_mkclean(pmd)	pte_pmd(pte_mkclean(pmd_pte(pmd)))
 #define pmd_mkdirty(pmd)	pte_pmd(pte_mkdirty(pmd_pte(pmd)))
 #define pmd_mkyoung(pmd)	pte_pmd(pte_mkyoung(pmd_pte(pmd)))
-#define pmd_mknotpresent(pmd)	(__pmd(pmd_val(pmd) & ~PMD_SECT_VALID))
+#define pmd_mknotvalid(pmd)	(__pmd(pmd_val(pmd) & ~PMD_SECT_VALID))
 
 #define pmd_thp_or_huge(pmd)	(pmd_huge(pmd) || pmd_trans_huge(pmd))
 
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index aef5378f909c..2a66dee3a9b8 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -615,7 +615,7 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
 	return pmd;
 }
 
-static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+static inline pmd_t pmd_mknotvalid(pmd_t pmd)
 {
 	pmd_val(pmd) &= ~(_PAGE_PRESENT | _PAGE_VALID | _PAGE_DIRTY);
 
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 7e118660bbd9..6279668d430f 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -589,7 +589,7 @@ static inline pud_t pfn_pud(unsigned long page_nr, pgprot_t pgprot)
 	return __pud(pfn | check_pgprot(pgprot));
 }
 
-static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+static inline pmd_t pmd_mknotvalid(pmd_t pmd)
 {
 	return pfn_pmd(pmd_pfn(pmd),
 		      __pgprot(pmd_flags(pmd) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index 49d7814b59a9..f9f61b934475 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -130,7 +130,7 @@ static void clear_pmd_presence(pmd_t *pmd, bool clear, pmdval_t *old)
 	pmdval_t v = pmd_val(*pmd);
 	if (clear) {
 		*old = v;
-		new_pmd = pmd_mknotpresent(*pmd);
+		new_pmd = pmd_mknotvalid(*pmd);
 	} else {
 		/* Presume this has been called with clear==true previously */
 		new_pmd = __pmd(*old);
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index 3d7c01e76efc..5b8055ef4120 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -194,7 +194,7 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
 pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
 		     pmd_t *pmdp)
 {
-	pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mknotpresent(*pmdp));
+	pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mknotvalid(*pmdp));
 	flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
 	return old;
 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
  2020-03-20  4:54 [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
  2020-03-20  4:54 ` [PATCH 1/2] powerpc/mm: Drop platform defined pmd_mknotpresent() Anshuman Khandual
  2020-03-20  4:54 ` [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
@ 2020-03-29 13:42 ` Anshuman Khandual
  2020-03-30 22:51   ` Andrew Morton
  2 siblings, 1 reply; 9+ messages in thread
From: Anshuman Khandual @ 2020-03-29 13:42 UTC (permalink / raw)
  To: linux-mm
  Cc: Benjamin Herrenschmidt, Michael Ellerman, Paul Mackerras,
	Vineet Gupta, Russell King, Catalin Marinas, Will Deacon,
	Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Andrew Morton, nouveau,
	linuxppc-dev, linux-snps-arc, linux-arm-kernel, linux-mips, x86,
	linux-kernel



On 03/20/2020 10:24 AM, Anshuman Khandual wrote:
> This series renames pmd_mknotpresent() as pmd_mknotvalid(). Before that it
> drops an existing pmd_mknotpresent() definition from powerpc platform which
> was never required as it defines it's pmdp_invalidate() through subscribing
> __HAVE_ARCH_PMDP_INVALIDATE. This does not create any functional change.
> 
> This rename was suggested by Catalin during a previous discussion while we
> were trying to change the THP helpers on arm64 platform for migration.
> 
> https://patchwork.kernel.org/patch/11019637/
> 
> This series is based on v5.6-rc6.
> 
> Boot tested on arm64 and x86 platforms.
> Built tested on many other platforms including the ones changed here.

Gentle ping, any updates regarding this ?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
  2020-03-29 13:42 ` [PATCH 0/2] " Anshuman Khandual
@ 2020-03-30 22:51   ` Andrew Morton
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Morton @ 2020-03-30 22:51 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras, Vineet Gupta, Russell King, Catalin Marinas,
	Will Deacon, Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, nouveau, linuxppc-dev,
	linux-snps-arc, linux-arm-kernel, linux-mips, x86, linux-kernel

On Sun, 29 Mar 2020 19:12:35 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:

> 
> 
> On 03/20/2020 10:24 AM, Anshuman Khandual wrote:
> > This series renames pmd_mknotpresent() as pmd_mknotvalid(). Before that it
> > drops an existing pmd_mknotpresent() definition from powerpc platform which
> > was never required as it defines it's pmdp_invalidate() through subscribing
> > __HAVE_ARCH_PMDP_INVALIDATE. This does not create any functional change.
> > 
> > This rename was suggested by Catalin during a previous discussion while we
> > were trying to change the THP helpers on arm64 platform for migration.
> > 
> > https://patchwork.kernel.org/patch/11019637/
> > 
> > This series is based on v5.6-rc6.
> > 
> > Boot tested on arm64 and x86 platforms.
> > Built tested on many other platforms including the ones changed here.
> 
> Gentle ping, any updates regarding this ?

We're in the merge window so I have parked this for consideration after
-rc1.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
  2020-03-20  4:54 ` [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
@ 2020-04-20 21:03   ` Will Deacon
  2020-04-20 23:27     ` Anshuman Khandual
  0 siblings, 1 reply; 9+ messages in thread
From: Will Deacon @ 2020-04-20 21:03 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Vineet Gupta, Russell King, Catalin Marinas,
	Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Andrew Morton, nouveau,
	linux-snps-arc, linux-arm-kernel, linux-mips, x86, linux-kernel

On Fri, Mar 20, 2020 at 10:24:17AM +0530, Anshuman Khandual wrote:
> 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_mknotvalid() 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_mknotvalid(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.

Bikeshed alert: maybe pmd_mkinvalid() would be better, given that this is
a one-trick pony for pmdp_invalidate()?

Will


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
  2020-04-20 21:03   ` Will Deacon
@ 2020-04-20 23:27     ` Anshuman Khandual
  2020-04-21  7:07       ` Will Deacon
  0 siblings, 1 reply; 9+ messages in thread
From: Anshuman Khandual @ 2020-04-20 23:27 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-mm, Vineet Gupta, Russell King, Catalin Marinas,
	Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Andrew Morton, nouveau,
	linux-snps-arc, linux-arm-kernel, linux-mips, x86, linux-kernel



On 04/21/2020 02:33 AM, Will Deacon wrote:
> On Fri, Mar 20, 2020 at 10:24:17AM +0530, Anshuman Khandual wrote:
>> 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_mknotvalid() 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_mknotvalid(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.
> 
> Bikeshed alert: maybe pmd_mkinvalid() would be better, given that this is
> a one-trick pony for pmdp_invalidate()?

I had thought about making it pmd_mkinvalid() earlier. But as we were replacing
pmd_mknotpresent(), hence went with similar pattern pmd_mknotvalid() which was
originally suggested by Catalin. There is an existing pte_mknotpresent() in arc
platform as well. I dont have a very strong opinion either way, will be happy
to rename. But then still wondering if we really need to.

> 
> Will
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
  2020-04-20 23:27     ` Anshuman Khandual
@ 2020-04-21  7:07       ` Will Deacon
  2020-04-21  8:09         ` Anshuman Khandual
  0 siblings, 1 reply; 9+ messages in thread
From: Will Deacon @ 2020-04-21  7:07 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Vineet Gupta, Russell King, Catalin Marinas,
	Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Andrew Morton, nouveau,
	linux-snps-arc, linux-arm-kernel, linux-mips, x86, linux-kernel

On Tue, Apr 21, 2020 at 04:57:26AM +0530, Anshuman Khandual wrote:
> 
> 
> On 04/21/2020 02:33 AM, Will Deacon wrote:
> > On Fri, Mar 20, 2020 at 10:24:17AM +0530, Anshuman Khandual wrote:
> >> 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_mknotvalid() 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_mknotvalid(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.
> > 
> > Bikeshed alert: maybe pmd_mkinvalid() would be better, given that this is
> > a one-trick pony for pmdp_invalidate()?
> 
> I had thought about making it pmd_mkinvalid() earlier. But as we were replacing
> pmd_mknotpresent(), hence went with similar pattern pmd_mknotvalid() which was
> originally suggested by Catalin. There is an existing pte_mknotpresent() in arc
> platform as well. I dont have a very strong opinion either way, will be happy
> to rename. But then still wondering if we really need to.

I just think that having pmdp_invalidate() call pmd_mkinvalid() makes a lot
of sense and, since this is a pure renaming patch, then that's worth taking
into consideration.

If you go with pmd_mkinvalid(), then:

Acked-by: Will Deacon <will@kernel.org>

Will


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
  2020-04-21  7:07       ` Will Deacon
@ 2020-04-21  8:09         ` Anshuman Khandual
  0 siblings, 0 replies; 9+ messages in thread
From: Anshuman Khandual @ 2020-04-21  8:09 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-mm, Vineet Gupta, Russell King, Catalin Marinas,
	Thomas Bogendoerfer, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Steven Rostedt, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, Andrew Morton, nouveau,
	linux-snps-arc, linux-arm-kernel, linux-mips, x86, linux-kernel



On 04/21/2020 12:37 PM, Will Deacon wrote:
> On Tue, Apr 21, 2020 at 04:57:26AM +0530, Anshuman Khandual wrote:
>>
>>
>> On 04/21/2020 02:33 AM, Will Deacon wrote:
>>> On Fri, Mar 20, 2020 at 10:24:17AM +0530, Anshuman Khandual wrote:
>>>> 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_mknotvalid() 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_mknotvalid(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.
>>>
>>> Bikeshed alert: maybe pmd_mkinvalid() would be better, given that this is
>>> a one-trick pony for pmdp_invalidate()?
>>
>> I had thought about making it pmd_mkinvalid() earlier. But as we were replacing
>> pmd_mknotpresent(), hence went with similar pattern pmd_mknotvalid() which was
>> originally suggested by Catalin. There is an existing pte_mknotpresent() in arc
>> platform as well. I dont have a very strong opinion either way, will be happy
>> to rename. But then still wondering if we really need to.
> 
> I just think that having pmdp_invalidate() call pmd_mkinvalid() makes a lot
> of sense and, since this is a pure renaming patch, then that's worth taking
> into consideration.

Sure np, will do.

> 
> If you go with pmd_mkinvalid(), then:
> 
> Acked-by: Will Deacon <will@kernel.org>
> 
> Will
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-04-21  8:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20  4:54 [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
2020-03-20  4:54 ` [PATCH 1/2] powerpc/mm: Drop platform defined pmd_mknotpresent() Anshuman Khandual
2020-03-20  4:54 ` [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid() Anshuman Khandual
2020-04-20 21:03   ` Will Deacon
2020-04-20 23:27     ` Anshuman Khandual
2020-04-21  7:07       ` Will Deacon
2020-04-21  8:09         ` Anshuman Khandual
2020-03-29 13:42 ` [PATCH 0/2] " Anshuman Khandual
2020-03-30 22:51   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).