From: Magnus Lindholm <linmag7@gmail.com>
To: richard.henderson@linaro.org, mattst88@gmail.com,
linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org
Cc: linmag7@gmail.com, stable@vger.kernel.org
Subject: [PATCH v3 3/7] alpha: fix the local TLB invalidate in flush_tlb_page()
Date: Wed, 23 Sep 2026 09:47:46 +0200 [thread overview]
Message-ID: <20260923074903.862898-4-linmag7@gmail.com> (raw)
In-Reply-To: <20260923074903.862898-1-linmag7@gmail.com>
flush_tlb_page() invalidates the calling CPU itself before asking the
others, and gates that on current->active_mm. For a non-executable vma
that means a targeted tbi(2, addr), which acts on the context currently
loaded and is only guaranteed to invalidate the intended translations
when the target mm's context is the loaded one. A lazy active_mm does
not establish that, so as in ipi_flush_tlb_page() the target mm's stale
translations can survive, and nothing forces the old ASN to be retired
afterwards.
Test current->mm instead. The calling CPU then has no local invalidate
at all when the mm is only lazily borrowed; the next patch adds it.
Which callers reach here with a foreign mm depends on the configuration.
folio_mkclean(), from the writeback flusher kworker that has no mm of its
own, accounted for about half the calls during writeback of a shared
mapping and none at all on anonymous memory. Those counts were measured
with CONFIG_COMPACTION=n: with COMPACTION=y, asm/pgtable.h overrides
ptep_clear_flush() to call migrate_flush_tlb_page(), which rendezvouses
with every CPU and handles the context itself, so folio_mkclean() does
not reach this function.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
arch/alpha/kernel/smp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 1ad448105201..7856d23b3384 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -684,7 +684,8 @@ flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
preempt_disable();
- if (mm == current->active_mm) {
+ /* As in ipi_flush_tlb_page(): a targeted tbi() needs MM current. */
+ if (mm == current->mm) {
flush_tlb_current_page(mm, vma, addr);
if (atomic_read(&mm->mm_users) <= 1) {
int cpu, this_cpu = smp_processor_id();
--
2.43.0
next prev parent reply other threads:[~2026-09-23 7:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 7:47 [PATCH v3 0/7] alpha: fix stale TLB translations breaking copy-on-write and writeback Magnus Lindholm
2026-09-23 7:47 ` [PATCH v3 1/7] alpha: run check_mmu_context() from finish_arch_post_lock_switch() Magnus Lindholm
2026-10-08 21:27 ` Matt Turner
2026-09-23 7:47 ` [PATCH v3 2/7] alpha: only use a targeted tbi() when the target mm is really current Magnus Lindholm
2026-09-23 7:47 ` Magnus Lindholm [this message]
2026-10-08 21:28 ` [PATCH v3 3/7] alpha: fix the local TLB invalidate in flush_tlb_page() Matt Turner
2026-09-23 7:47 ` [PATCH v3 4/7] alpha: invalidate the local context " Magnus Lindholm
2026-09-23 7:47 ` [PATCH v3 5/7] alpha: fix the local TLB invalidate in the UP flush_tlb_page() Magnus Lindholm
2026-09-23 7:47 ` [PATCH v3 6/7] alpha: invalidate the local context in flush_tlb_mm() Magnus Lindholm
2026-10-08 21:28 ` Matt Turner
2026-09-23 7:47 ` [PATCH v3 7/7] alpha: invalidate the local context in flush_icache_user_page() Magnus Lindholm
2026-10-08 21:28 ` [PATCH v3 0/7] alpha: fix stale TLB translations breaking copy-on-write and writeback Matt Turner
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=20260923074903.862898-4-linmag7@gmail.com \
--to=linmag7@gmail.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mattst88@gmail.com \
--cc=richard.henderson@linaro.org \
--cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.