Re: [PATCH v4 2/2] alpha: do not skip TLB shootdown IPIs for kthread-borrowed mms
From: Magnus Lindholm
Date: Sun Oct 11 2026 - 12:26:33 EST
Hi Matt,
On Sun, Oct 11, 2026 at 1:34 AM Matt Turner <mattst88@xxxxxxxxx> wrote:
>
> On Sat, Oct 10, 2026 at 16:33 +0200, Magnus Lindholm wrote:
> > This requires the preceding removal of remote slot clearing from
> > migrate_flush_tlb_page(). It also requires the stale-TLB series to set
> > need_new_asn on both the reused and newly allocated ASN paths.
> [...]
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > Cc: stable@xxxxxxxxxxxxxxx
>
> With that Fixes tag this will be tried on every stable tree, and the
> dependency is only in the prose. The hunk context includes comments the
> stale-TLB series adds, so it will fail to apply rather than misapply,
> which is the safe outcome. Naming the prerequisites on the Cc: stable
> line would still save a round of FAILED mails.
>
Thanks, fixed in for-next. I've added the prerequisite commits to the
Cc: stable annotations.
> > + /*
> > + * Ordered before any use of the mm by the mb() in
> > + * arch_spin_unlock(), when finish_lock_switch() drops
> > + * the rq lock.
> > + */
> > + WRITE_ONCE(next_mm->context[cpu], mmc);
>
> "Any use of the mm" is slightly too strong: swpctx loads the new ptbr
> and ASN in switch_to(), before the unlock. What the ordering has to
> precede is the first TLB fill for a user address, so maybe:
>
> /*
> * Ordered before any user access through the mm by the
> * mb() in arch_spin_unlock(), when finish_lock_switch()
> * drops the rq lock.
> */
>
> Fine as a fixup, no need for a v5 on my account.
>
I've changed the comment to "before any user access
through the mm" as suggested, and refilled the changelog paragraph.
No functional changes, your Reviewed-by is retained.
> > + if (atomic_read(&mm->mm_users) <= 1 &&
> > + !mm_context_elsewhere(mm)) {
>
> Not for this series: once every slot has a single writer, I think the
> slot test is sufficient by itself and mm_users only narrows the
> shortcut. Dropping it later would extend the shortcut to a
> multithreaded process whose threads all sit on one CPU. Worth a look
> after this has had some soak time.
>
Interesting, that is for sure worth looking into.
>
> Nit: the changelog paragraph starting "Order the slot reads" has a short
> line at "Also issue smp_mb() after" that wants refilling.
The combined TLB v5 and MMU v4 stack has now completed an SMP compaction
soak on the ES40 with three CPUs online and CONFIG_COMPACTION=y.
Regards
Magnus