Re: [PATCH 1/2] sparc64: flush only the aliased page, not its whole folio
From: Stian Halseth
Date: Mon Sep 28 2026 - 05:32:37 EST
Hi Imre,
On Sun, 2026-09-27 at 12:55 +0200, Imre Kaloz wrote:
> Since the conversion to folios, move_pte() and tlb_batch_add() flush
> the
> D-cache of every page in the folio a single PTE maps. Both run once
> per
> PTE, so moving or unmapping a range backed by a large folio flushes
> each
> of its pages once for every PTE of that folio, and each page flush is
> a
> cross-call to all other online CPUs.
>
> Only the page the PTE maps can hold lines at the old colour, so flush
> just that page, as before the conversion. flush_dcache_folio_all()
> has
> no other users and becomes flush_dcache_page_all() again.
>
> On SMP QEMU guests, apt rebuilding its caches through mremap()
> triggers
> RCU stalls and soft lockups in move_pte().
Confirmed on a Sun Fire V240 (UltraSPARC IIIi, SMP, THP madvise).
The unpatched kernel exhibits the quadratic slowdown patch 1 fixes: a
same-colour 2-page move takes 0.4 ms, but a colour-flipping 1-page move
takes 7293 ms (roughly a million redundant page flushes across 1024
PTEs). Thanks for the fix!
No regressions found on sun4v (SPARC T4-1).
Tested-by: Stian Halseth <stian@xxxxxx> # Sun Fire V240, SPARC T4-1
Attachment:
signature.asc
Description: This is a digitally signed message part