* [PATCH v2 0/3] mm: cleanup clear_not_present_full_ptes()
@ 2026-06-29 13:49 David Hildenbrand (Arm)
2026-06-29 13:49 ` [PATCH v2 1/3] sparc/mm: drop custom pte_clear_not_present_full() David Hildenbrand (Arm)
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: David Hildenbrand (Arm) @ 2026-06-29 13:49 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andrew Morton, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jann Horn, Peter Zijlstra,
Oscar Salvador (SUSE)
Cc: sparclinux, linux-kernel, linux-mm, David Hildenbrand (Arm)
While doing some review, I stumbled over clear_not_present_full_ptes()
and concluded that it needs some love.
Let's remove pte_clear_not_present_full() and cleanup
clear_not_present_full_ptes(), renaming it to clear_non_present_ptes().
Heavily build-tested, runtime tested only on x86-64.
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
Changes in v2:
- Silence warning in patch #2 with architectures that don't use addr in
their pte_clear() macro by using "(void)addr"
- Refine patch descriptions.
- Link to v1: https://lore.kernel.org/r/20260611-clear_not_present_full_ptes-v1-0-49865fc82629@kernel.org
---
David Hildenbrand (Arm) (3):
sparc/mm: drop custom pte_clear_not_present_full()
mm: drop pte_clear_not_present_full()
mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes()
arch/sparc/include/asm/pgtable_64.h | 4 ----
include/linux/pgtable.h | 33 +++++++--------------------------
mm/madvise.c | 6 +++---
mm/memory.c | 2 +-
4 files changed, 11 insertions(+), 34 deletions(-)
---
base-commit: fe61612214b618072b4ea3f5065a81296df6dd75
change-id: 20260610-clear_not_present_full_ptes-df3258baf7ed
--
Cheers,
David
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/3] sparc/mm: drop custom pte_clear_not_present_full()
2026-06-29 13:49 [PATCH v2 0/3] mm: cleanup clear_not_present_full_ptes() David Hildenbrand (Arm)
@ 2026-06-29 13:49 ` David Hildenbrand (Arm)
2026-06-30 12:03 ` Lance Yang
2026-06-29 13:49 ` [PATCH v2 2/3] mm: drop pte_clear_not_present_full() David Hildenbrand (Arm)
2026-06-29 13:49 ` [PATCH v2 3/3] mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes() David Hildenbrand (Arm)
2 siblings, 1 reply; 11+ messages in thread
From: David Hildenbrand (Arm) @ 2026-06-29 13:49 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andrew Morton, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jann Horn, Peter Zijlstra,
Oscar Salvador (SUSE)
Cc: sparclinux, linux-kernel, linux-mm, David Hildenbrand (Arm)
On sparc64, pte_clear_not_present_full() nowadays does a simple
__set_pte_at(). In __set_pte_at() -> maybe_tlb_batch_add(), we check
pte_accessible() to see whether to call tlb_batch_add().
However, non-present PTEs are surely not accessible, so tlb_batch_add()
is never called and the "full" parameter is irrelevant.
Let's drop the helper and just let common code do a pte_clear().
pte_clear() on sparc64 maps to set_pte_at()->set_ptes()->__set_pte_at()
... so it ends up calling the same function, just with "full=0".
Given that "full" is irrelevant, there is no change.
We added pte_clear_not_present_full() for sparc64 in commit 90f08e399d05
("sparc: mmu_gather rework"), and I suspect that it was already not
required back then.
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
arch/sparc/include/asm/pgtable_64.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 74ede706fb325..0837ebbc5dce6 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -945,10 +945,6 @@ static inline void set_ptes(struct mm_struct *mm, unsigned long addr,
#define pte_clear(mm,addr,ptep) \
set_pte_at((mm), (addr), (ptep), __pte(0UL))
-#define __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL
-#define pte_clear_not_present_full(mm,addr,ptep,fullmm) \
- __set_pte_at((mm), (addr), (ptep), __pte(0UL), (fullmm))
-
#ifdef DCACHE_ALIASING_POSSIBLE
#define __HAVE_ARCH_MOVE_PTE
#define move_pte(pte, old_addr, new_addr) \
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/3] mm: drop pte_clear_not_present_full()
2026-06-29 13:49 [PATCH v2 0/3] mm: cleanup clear_not_present_full_ptes() David Hildenbrand (Arm)
2026-06-29 13:49 ` [PATCH v2 1/3] sparc/mm: drop custom pte_clear_not_present_full() David Hildenbrand (Arm)
@ 2026-06-29 13:49 ` David Hildenbrand (Arm)
2026-06-29 17:22 ` Andrew Morton
2026-06-30 12:38 ` Lance Yang
2026-06-29 13:49 ` [PATCH v2 3/3] mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes() David Hildenbrand (Arm)
2 siblings, 2 replies; 11+ messages in thread
From: David Hildenbrand (Arm) @ 2026-06-29 13:49 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andrew Morton, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jann Horn, Peter Zijlstra,
Oscar Salvador (SUSE)
Cc: sparclinux, linux-kernel, linux-mm, David Hildenbrand (Arm)
In general, there is no good reason to do anything special when clearing
non-present PTEs.
In theory, HW that does have to invalidate TLBs for non-present PTEs could
benefit from a "full" parameter, but fortunately
pte_clear_not_present_full() is not wired up anymore ... and there would
have to be something very convincing for us to care about that to re-add
it.
So, let's just use pte_clear() directly now. To avoid the compiler
complaining on some configs about unused "addr" parameter, silence that
here.
Reviewed-by: Oscar Salvador (SUSE) <osalvador@kernel.org>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
include/linux/pgtable.h | 21 ++++-----------------
mm/madvise.c | 4 ++--
2 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index dc804296d78f7..0b81e396816a5 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -988,21 +988,6 @@ static inline void update_mmu_tlb(struct vm_area_struct *vma,
update_mmu_tlb_range(vma, address, ptep, 1);
}
-/*
- * Some architectures may be able to avoid expensive synchronization
- * primitives when modifications are made to PTE's which are already
- * not present, or in the process of an address space destruction.
- */
-#ifndef __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL
-static inline void pte_clear_not_present_full(struct mm_struct *mm,
- unsigned long address,
- pte_t *ptep,
- int full)
-{
- pte_clear(mm, address, ptep);
-}
-#endif
-
#ifndef clear_not_present_full_ptes
/**
* clear_not_present_full_ptes - Clear multiple not present PTEs which are
@@ -1014,7 +999,7 @@ static inline void pte_clear_not_present_full(struct mm_struct *mm,
* @full: Whether we are clearing a full mm.
*
* May be overridden by the architecture; otherwise, implemented as a simple
- * loop over pte_clear_not_present_full().
+ * loop over pte_clear().
*
* Context: The caller holds the page table lock. The PTEs are all not present.
* The PTEs are all in the same PMD.
@@ -1022,8 +1007,10 @@ static inline void pte_clear_not_present_full(struct mm_struct *mm,
static inline void clear_not_present_full_ptes(struct mm_struct *mm,
unsigned long addr, pte_t *ptep, unsigned int nr, int full)
{
+ (void)addr;
+
for (;;) {
- pte_clear_not_present_full(mm, addr, ptep, full);
+ pte_clear(mm, addr, ptep);
if (--nr == 0)
break;
ptep++;
diff --git a/mm/madvise.c b/mm/madvise.c
index cd9bb077072cc..f3cda54c1d6a0 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -698,7 +698,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
clear_not_present_full_ptes(mm, addr, pte, nr, tlb->fullmm);
} else if (softleaf_is_hwpoison(entry) ||
softleaf_is_poison_marker(entry)) {
- pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
+ pte_clear(mm, addr, pte);
}
continue;
}
@@ -1234,7 +1234,7 @@ static int guard_remove_pte_entry(pte_t *pte, unsigned long addr,
if (is_guard_pte_marker(ptent)) {
/* Simply clear the PTE marker. */
- pte_clear_not_present_full(walk->mm, addr, pte, false);
+ pte_clear(walk->mm, addr, pte);
update_mmu_cache(walk->vma, addr, pte);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/3] mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes()
2026-06-29 13:49 [PATCH v2 0/3] mm: cleanup clear_not_present_full_ptes() David Hildenbrand (Arm)
2026-06-29 13:49 ` [PATCH v2 1/3] sparc/mm: drop custom pte_clear_not_present_full() David Hildenbrand (Arm)
2026-06-29 13:49 ` [PATCH v2 2/3] mm: drop pte_clear_not_present_full() David Hildenbrand (Arm)
@ 2026-06-29 13:49 ` David Hildenbrand (Arm)
2026-06-30 13:05 ` Lance Yang
2 siblings, 1 reply; 11+ messages in thread
From: David Hildenbrand (Arm) @ 2026-06-29 13:49 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, Andrew Morton, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jann Horn, Peter Zijlstra,
Oscar Salvador (SUSE)
Cc: sparclinux, linux-kernel, linux-mm, David Hildenbrand (Arm)
Let's clean it up a bit:
(1) There is no need to pass "full" anymore.
(2) No architecture overwrites it, and there isn't really a good reason
to do so when dealing with non-resent PTEs.
(3) While at it, call it "non-present", similar to copy_nonpresent_pte()
and zap_nonpresent_ptes().
It's a shame that we have clear_non_present_ptes() correspond to
pte_clear() and clear_ptes() correspond to ptep_get_and_clear*().
Reviewed-by: Oscar Salvador (SUSE) <osalvador@kernel.org>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
include/linux/pgtable.h | 14 ++++----------
mm/madvise.c | 2 +-
mm/memory.c | 2 +-
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 0b81e396816a5..d52d2a976e5a2 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -988,24 +988,19 @@ static inline void update_mmu_tlb(struct vm_area_struct *vma,
update_mmu_tlb_range(vma, address, ptep, 1);
}
-#ifndef clear_not_present_full_ptes
/**
- * clear_not_present_full_ptes - Clear multiple not present PTEs which are
- * consecutive in the pgtable.
+ * clear_nonpresent_ptes - Clear multiple non-present PTEs which are
+ * consecutive in the pgtable.
* @mm: Address space the ptes represent.
* @addr: Address of the first pte.
* @ptep: Page table pointer for the first entry.
* @nr: Number of entries to clear.
- * @full: Whether we are clearing a full mm.
- *
- * May be overridden by the architecture; otherwise, implemented as a simple
- * loop over pte_clear().
*
* Context: The caller holds the page table lock. The PTEs are all not present.
* The PTEs are all in the same PMD.
*/
-static inline void clear_not_present_full_ptes(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep, unsigned int nr, int full)
+static inline void clear_nonpresent_ptes(struct mm_struct *mm,
+ unsigned long addr, pte_t *ptep, unsigned int nr)
{
(void)addr;
@@ -1017,7 +1012,6 @@ static inline void clear_not_present_full_ptes(struct mm_struct *mm,
addr += PAGE_SIZE;
}
}
-#endif
#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
extern pte_t ptep_clear_flush(struct vm_area_struct *vma,
diff --git a/mm/madvise.c b/mm/madvise.c
index f3cda54c1d6a0..3db143c442eaa 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -695,7 +695,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
nr = swap_pte_batch(pte, max_nr, ptent);
nr_swap -= nr;
swap_put_entries_direct(entry, nr);
- clear_not_present_full_ptes(mm, addr, pte, nr, tlb->fullmm);
+ clear_nonpresent_ptes(mm, addr, pte, nr);
} else if (softleaf_is_hwpoison(entry) ||
softleaf_is_poison_marker(entry)) {
pte_clear(mm, addr, pte);
diff --git a/mm/memory.c b/mm/memory.c
index ff338c2abe923..a3fcaf8cfe8f8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1797,7 +1797,7 @@ static inline int zap_nonpresent_ptes(struct mmu_gather *tlb,
pr_alert("unrecognized swap entry 0x%lx\n", entry.val);
WARN_ON_ONCE(1);
}
- clear_not_present_full_ptes(vma->vm_mm, addr, pte, nr, tlb->fullmm);
+ clear_nonpresent_ptes(vma->vm_mm, addr, pte, nr);
*any_skipped = zap_install_uffd_wp_if_needed(vma, addr, pte, nr, details, ptent);
return nr;
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/3] mm: drop pte_clear_not_present_full()
2026-06-29 13:49 ` [PATCH v2 2/3] mm: drop pte_clear_not_present_full() David Hildenbrand (Arm)
@ 2026-06-29 17:22 ` Andrew Morton
2026-06-29 17:43 ` David Hildenbrand (Arm)
2026-06-30 12:38 ` Lance Yang
1 sibling, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2026-06-29 17:22 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: David S. Miller, Andreas Larsson, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jann Horn, Peter Zijlstra,
Oscar Salvador (SUSE), sparclinux, linux-kernel, linux-mm
On Mon, 29 Jun 2026 15:49:48 +0200 "David Hildenbrand (Arm)" <david@kernel.org> wrote:
> In general, there is no good reason to do anything special when clearing
> non-present PTEs.
>
> In theory, HW that does have to invalidate TLBs for non-present PTEs could
> benefit from a "full" parameter, but fortunately
> pte_clear_not_present_full() is not wired up anymore ... and there would
> have to be something very convincing for us to care about that to re-add
> it.
>
> So, let's just use pte_clear() directly now. To avoid the compiler
> complaining on some configs about unused "addr" parameter, silence that
> here.
Wait, which configs do that?
> @@ -1022,8 +1007,10 @@ static inline void pte_clear_not_present_full(struct mm_struct *mm,
> static inline void clear_not_present_full_ptes(struct mm_struct *mm,
> unsigned long addr, pte_t *ptep, unsigned int nr, int full)
> {
> + (void)addr;
> +
We heavily rely on this warning not happening.
eg, one of thousands:
static inline bool page_range_contiguous(const struct page *page,
unsigned long nr_pages)
{
return true;
}
So... what's happening here?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/3] mm: drop pte_clear_not_present_full()
2026-06-29 17:22 ` Andrew Morton
@ 2026-06-29 17:43 ` David Hildenbrand (Arm)
2026-06-29 21:08 ` Andrew Morton
0 siblings, 1 reply; 11+ messages in thread
From: David Hildenbrand (Arm) @ 2026-06-29 17:43 UTC (permalink / raw)
To: Andrew Morton
Cc: David S. Miller, Andreas Larsson, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jann Horn, Peter Zijlstra,
Oscar Salvador (SUSE), sparclinux, linux-kernel, linux-mm
On 6/29/26 19:22, Andrew Morton wrote:
> On Mon, 29 Jun 2026 15:49:48 +0200 "David Hildenbrand (Arm)" <david@kernel.org> wrote:
>
>> In general, there is no good reason to do anything special when clearing
>> non-present PTEs.
>>
>> In theory, HW that does have to invalidate TLBs for non-present PTEs could
>> benefit from a "full" parameter, but fortunately
>> pte_clear_not_present_full() is not wired up anymore ... and there would
>> have to be something very convincing for us to care about that to re-add
>> it.
>>
>> So, let's just use pte_clear() directly now. To avoid the compiler
>> complaining on some configs about unused "addr" parameter, silence that
>> here.
>
> Wait, which configs do that?
>
>> @@ -1022,8 +1007,10 @@ static inline void pte_clear_not_present_full(struct mm_struct *mm,
>> static inline void clear_not_present_full_ptes(struct mm_struct *mm,
>> unsigned long addr, pte_t *ptep, unsigned int nr, int full)
>> {
>> + (void)addr;
>> +
>
> We heavily rely on this warning not happening.
>
> eg, one of thousands:
>
> static inline bool page_range_contiguous(const struct page *page,
> unsigned long nr_pages)
> {
> return true;
> }
>
> So... what's happening here?
"nr_pages" are not modified in the function, so the compile does not complain.
See below.
A private build bot barked at me after v1 for
arm-linux-gnueabi-gcc
openrisc-allnoconfig
um-allmodconfig
For example:
https://lore.kernel.org/all/202606121420.Wke8Ipgx-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/kasan.h:38,
from include/linux/slab.h:264,
from lib/test_bitops.c:12:
include/linux/pgtable.h: In function 'clear_not_present_full_ptes':
>> include/linux/pgtable.h:974:31: error: parameter 'addr' set but not used
[-Werror=unused-but-set-parameter=]
974 | unsigned long addr, pte_t *ptep, unsigned int nr, int
full)
| ~~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors
The problem is that addr is updated (written) in the function but never read.
This becomes visible once pte_clear() is a macro instead of a function.
arch/arm/include/asm/pgtable.h:#define pte_clear(mm,addr,ptep)
set_pte_ext(ptep, __pte(0), 0)
"(void) addr" silences bots. An alternative would be to find all such macros and
convert them into (assuming inline function is non-trivial)
#define pte_clear(mm,addr,ptep) ((void)addr, set_pte_ext(ptep, __pte(0), 0))
Something I wanted to avoid for this simple patch here that just removes one
function indirection.
--
Cheers,
David
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/3] mm: drop pte_clear_not_present_full()
2026-06-29 17:43 ` David Hildenbrand (Arm)
@ 2026-06-29 21:08 ` Andrew Morton
0 siblings, 0 replies; 11+ messages in thread
From: Andrew Morton @ 2026-06-29 21:08 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: David S. Miller, Andreas Larsson, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jann Horn, Peter Zijlstra,
Oscar Salvador (SUSE), sparclinux, linux-kernel, linux-mm
On Mon, 29 Jun 2026 19:43:53 +0200 "David Hildenbrand (Arm)" <david@kernel.org> wrote:
> > So... what's happening here?
>
> "nr_pages" are not modified in the function, so the compile does not complain.
> See below.
>
>
> A private build bot barked at me after v1 for
>
> arm-linux-gnueabi-gcc
> openrisc-allnoconfig
> um-allmodconfig
>
> For example:
>
> https://lore.kernel.org/all/202606121420.Wke8Ipgx-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/kasan.h:38,
> from include/linux/slab.h:264,
> from lib/test_bitops.c:12:
> include/linux/pgtable.h: In function 'clear_not_present_full_ptes':
> >> include/linux/pgtable.h:974:31: error: parameter 'addr' set but not used
> [-Werror=unused-but-set-parameter=]
> 974 | unsigned long addr, pte_t *ptep, unsigned int nr, int
> full)
> | ~~~~~~~~~~~~~~^~~~
> cc1: all warnings being treated as errors
>
>
> The problem is that addr is updated (written) in the function but never read.
Oh, OK, thanks. I altered the changelog to read
"To prevent the compiler complaining on some configs about "set but not
used" addr parameter, silence that here."
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] sparc/mm: drop custom pte_clear_not_present_full()
2026-06-29 13:49 ` [PATCH v2 1/3] sparc/mm: drop custom pte_clear_not_present_full() David Hildenbrand (Arm)
@ 2026-06-30 12:03 ` Lance Yang
0 siblings, 0 replies; 11+ messages in thread
From: Lance Yang @ 2026-06-30 12:03 UTC (permalink / raw)
To: david
Cc: davem, andreas, akpm, ljs, liam, vbabka, rppt, surenb, mhocko,
jannh, peterz, osalvador, sparclinux, linux-kernel, linux-mm,
Lance Yang
On Mon, Jun 29, 2026 at 03:49:47PM +0200, David Hildenbrand (Arm) wrote:
>On sparc64, pte_clear_not_present_full() nowadays does a simple
>__set_pte_at(). In __set_pte_at() -> maybe_tlb_batch_add(), we check
>pte_accessible() to see whether to call tlb_batch_add().
>
>However, non-present PTEs are surely not accessible, so tlb_batch_add()
>is never called and the "full" parameter is irrelevant.
>
>Let's drop the helper and just let common code do a pte_clear().
>
>pte_clear() on sparc64 maps to set_pte_at()->set_ptes()->__set_pte_at()
>... so it ends up calling the same function, just with "full=0".
>
>Given that "full" is irrelevant, there is no change.
>
>We added pte_clear_not_present_full() for sparc64 in commit 90f08e399d05
>("sparc: mmu_gather rework"), and I suspect that it was already not
>required back then.
>
>Cc: Peter Zijlstra <peterz@infradead.org>
>Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
>---
fullmm only matters if an old non-present PTE can pass pte_accessible().
IIUC, that doesn't happen on sparc64 :)
LGTM. Feel free to add:
Reviewed-by: Lance Yang <lance.yang@linux.dev>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/3] mm: drop pte_clear_not_present_full()
2026-06-29 13:49 ` [PATCH v2 2/3] mm: drop pte_clear_not_present_full() David Hildenbrand (Arm)
2026-06-29 17:22 ` Andrew Morton
@ 2026-06-30 12:38 ` Lance Yang
1 sibling, 0 replies; 11+ messages in thread
From: Lance Yang @ 2026-06-30 12:38 UTC (permalink / raw)
To: david
Cc: davem, andreas, akpm, ljs, liam, vbabka, rppt, surenb, mhocko,
jannh, peterz, osalvador, sparclinux, linux-kernel, linux-mm,
Lance Yang
On Mon, Jun 29, 2026 at 03:49:48PM +0200, David Hildenbrand (Arm) wrote:
>In general, there is no good reason to do anything special when clearing
>non-present PTEs.
>
>In theory, HW that does have to invalidate TLBs for non-present PTEs could
>benefit from a "full" parameter, but fortunately
>pte_clear_not_present_full() is not wired up anymore ... and there would
>have to be something very convincing for us to care about that to re-add
>it.
>
>So, let's just use pte_clear() directly now. To avoid the compiler
>complaining on some configs about unused "addr" parameter, silence that
>here.
>
>Reviewed-by: Oscar Salvador (SUSE) <osalvador@kernel.org>
>Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
>---
With the sparc64 override gone, pte_clear_not_present_full() is just
pte_clear() :)
LGTM. Feel free to add:
Reviewed-by: Lance Yang <lance.yang@linux.dev>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/3] mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes()
2026-06-29 13:49 ` [PATCH v2 3/3] mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes() David Hildenbrand (Arm)
@ 2026-06-30 13:05 ` Lance Yang
2026-06-30 13:47 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 11+ messages in thread
From: Lance Yang @ 2026-06-30 13:05 UTC (permalink / raw)
To: david
Cc: davem, andreas, akpm, ljs, liam, vbabka, rppt, surenb, mhocko,
jannh, peterz, osalvador, sparclinux, linux-kernel, linux-mm,
Lance Yang
On Mon, Jun 29, 2026 at 03:49:49PM +0200, David Hildenbrand (Arm) wrote:
>Let's clean it up a bit:
>
>(1) There is no need to pass "full" anymore.
>
>(2) No architecture overwrites it, and there isn't really a good reason
> to do so when dealing with non-resent PTEs.
Nit: "non-resent PTEs" -> "non-present PTEs".
>
>(3) While at it, call it "non-present", similar to copy_nonpresent_pte()
> and zap_nonpresent_ptes().
>
>It's a shame that we have clear_non_present_ptes() correspond to
>pte_clear() and clear_ptes() correspond to ptep_get_and_clear*().
>
>Reviewed-by: Oscar Salvador (SUSE) <osalvador@kernel.org>
>Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
>---
Nice cleanup! Feel free to add:
Reviewed-by: Lance Yang <lance.yang@linux.dev>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/3] mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes()
2026-06-30 13:05 ` Lance Yang
@ 2026-06-30 13:47 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 11+ messages in thread
From: David Hildenbrand (Arm) @ 2026-06-30 13:47 UTC (permalink / raw)
To: Lance Yang
Cc: davem, andreas, akpm, ljs, liam, vbabka, rppt, surenb, mhocko,
jannh, peterz, osalvador, sparclinux, linux-kernel, linux-mm
On 6/30/26 15:05, Lance Yang wrote:
>
> On Mon, Jun 29, 2026 at 03:49:49PM +0200, David Hildenbrand (Arm) wrote:
>> Let's clean it up a bit:
>>
>> (1) There is no need to pass "full" anymore.
>>
>> (2) No architecture overwrites it, and there isn't really a good reason
>> to do so when dealing with non-resent PTEs.
>
> Nit: "non-resent PTEs" -> "non-present PTEs".
Thanks, maybe Andrew can clean that up? Thanks!
--
Cheers,
David
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-06-30 13:47 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 13:49 [PATCH v2 0/3] mm: cleanup clear_not_present_full_ptes() David Hildenbrand (Arm)
2026-06-29 13:49 ` [PATCH v2 1/3] sparc/mm: drop custom pte_clear_not_present_full() David Hildenbrand (Arm)
2026-06-30 12:03 ` Lance Yang
2026-06-29 13:49 ` [PATCH v2 2/3] mm: drop pte_clear_not_present_full() David Hildenbrand (Arm)
2026-06-29 17:22 ` Andrew Morton
2026-06-29 17:43 ` David Hildenbrand (Arm)
2026-06-29 21:08 ` Andrew Morton
2026-06-30 12:38 ` Lance Yang
2026-06-29 13:49 ` [PATCH v2 3/3] mm: cleanup clear_not_present_full_ptes() and rename to clear_non_present_ptes() David Hildenbrand (Arm)
2026-06-30 13:05 ` Lance Yang
2026-06-30 13:47 ` David Hildenbrand (Arm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox