From: sashiko-bot@kernel.org
To: "Kiryl Shutsemau" <kas@kernel.org>,
"Dave Hansen" <dave.hansen@intel.com>
Cc: "Dave Hansen" <dave.hansen@linux.intel.com>,
"Andy Lutomirski" <luto@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Rick Edgecombe" <rick.p.edgecombe@intel.com>,
"Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Peter Xu" <peterx@redhat.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"David Hildenbrand (Arm)" <david@kernel.org>,
"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
"Pasha Tatashin" <pasha.tatashin@soleen.com>,
"Andrew Donnellan" <andrew+kernel@donnellan.id.au>,
"Rohan McLure" <rmclure@linux.ibm.com>,
"Baolin Wang" <baolin.wang@linux.alibaba.com>,
"Tejun Heo" <tj@kernel.org>,
"Jose A. Perez de Azpillaga" <azpijr@gmail.com>,
linux-mm@kvack.org, kernel-team@meta.com
Subject: Re: [PATCH] x86/mm: Define the zapped-entry checks only with CONFIG_DEBUG_VM
Date: Wed, 04 Nov 2026 10:13:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-197069@kernel.org> (raw)
In-Reply-To: <aumzjHyJsshPJBUI@thinkstation>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] x86/mm: commit title contradicts code and changelog has unstripped scissors
--
commit 1651219a7e4a74c995baa4203be8528bd7cfe1d0
Author: Kiryl Shutsemau <kas@kernel.org>
x86/mm: Define the zapped-entry checks only with CONFIG_DEBUG_VM
This commit removes the arch_check_zapped_pte(), arch_check_zapped_pmd(),
and arch_check_zapped_pud() helpers along with their callers and
pud_shstk() to avoid return mispredictions during page table zapping.
> x86/mm: Define the zapped-entry checks only with CONFIG_DEBUG_VM
>
> On Mon, Nov 02, 2026 at 01:12:47PM -0800, Dave Hansen wrote:
> > Or, heck, I'm not that attached to these checks. Let's just kill them.
>
> Works for me. x86 is the only architecture with them, although arm64 and
> riscv have shadow stacks too, and the x86 helpers already keep
> Write=0,Dirty=1 out of other VMAs. Patch below, without the Fixes: tag.
>
> Rick, any objection?
>
> -- >8 --
> From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
> Subject: [PATCH] x86/mm: Remove the zapped-entry checks
>
> Zapping a range calls arch_check_zapped_pte() for every batch of PTEs,
> which is every page for small folios, and arch_check_zapped_pmd() or
> arch_check_zapped_pud() for every huge leaf. Only x86 implements them, as
> out-of-line functions that warn about a shadow stack entry (Write=0,
> Dirty=1) in a VMA without VM_SHADOW_STACK.
>
> The warning is a VM_WARN_ON_ONCE(), so without CONFIG_DEBUG_VM the
> functions are empty, but the calls remain. With the SRSO "Safe RET"
> mitigation the return of every such call mispredicts.
>
> The x86 helpers already keep such entries out of other VMAs.
> pte_wrprotect(), pte_mkdirty(), pte_modify() and their PMD versions go
> through SavedDirty, and only pte_mkwrite() and pmd_mkwrite() on a
> VM_SHADOW_STACK VMA create the combination.
>
> Remove the checks, their callers and pud_shstk(), which has no other
> user.
>
> In a KVM guest on Zen 4 with Safe RET, zapping 4K pages takes one branch
> miss per page fewer. MADV_DONTNEED of 1 GiB gets 6% faster on anonymous
> memory and 8% on shmem, munmap() 5%. THP is unchanged. Without Safe RET
> the difference is within noise.
>
> Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
> Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
[Severity: Medium]
Was this patch applied without passing --scissors to git am?
The commit title still reads "x86/mm: Define the zapped-entry checks only
with CONFIG_DEBUG_VM", whereas the patch unconditionally deletes
arch_check_zapped_pte(), arch_check_zapped_pmd(), and
arch_check_zapped_pud() in arch/x86/mm/pgtable.c, arch/x86/include/asm/pgtable.h,
and include/linux/pgtable.h, along with pud_shstk() in
arch/x86/include/asm/pgtable.h and the callers in zap_present_folio_ptes()
and zap_present_ptes() in mm/memory.c and zap_huge_pmd() and zap_huge_pud()
in mm/huge_memory.c.
In addition, the changelog retains the mailing list reply, the "-- >8 --"
scissors line, and the embedded From and Subject headers ("x86/mm: Remove
the zapped-entry checks"). Should the preceding reply and scissors headers
be stripped and the commit title updated to "x86/mm: Remove the
zapped-entry checks"?
--
Sashiko AI review · https://sashiko.dev/#/patchset/aumzjHyJsshPJBUI@thinkstation?part=1
prev parent reply other threads:[~2026-11-04 10:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 14:39 [PATCH] x86/mm: Define the zapped-entry checks only with CONFIG_DEBUG_VM Kiryl Shutsemau (Meta)
2026-11-02 16:09 ` Jose A. Perez de Azpillaga
2026-11-02 16:53 ` Edgecombe, Rick P
2026-11-02 17:32 ` Kiryl Shutsemau
2026-11-02 19:07 ` Edgecombe, Rick P
2026-11-02 21:12 ` Dave Hansen
2026-11-03 10:13 ` Kiryl Shutsemau
2026-11-03 15:50 ` Edgecombe, Rick P
2026-11-04 10:13 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-197069@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrew+kernel@donnellan.id.au \
--cc=azpijr@gmail.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=pasha.tatashin@soleen.com \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=rmclure@linux.ibm.com \
--cc=rppt@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tglx@kernel.org \
--cc=tj@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox