From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Imre Kaloz <kaloz@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
"Mike Rapoport (IBM)" <rppt@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Liam R. Howlett" <liam@infradead.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Vlastimil Babka <vbabka@kernel.org>, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Magnus Lindholm <linmag7@gmail.com>
Subject: Re: [PATCH v3 4/4] mm: pass the number of PTEs to move_pte()
Date: Wed, 28 Oct 2026 09:49:00 +0100 [thread overview]
Message-ID: <dfe06aef-540a-4450-88ba-300a460007b7@kernel.org> (raw)
In-Reply-To: <20261027212610.6798-1-kaloz@kernel.org>
On 10/27/26 22:26, Imre Kaloz wrote:
> Hi David,
>
> On 10/23/26 22:53, David Hildenbrand (Arm) wrote:
>> Is there some way we can avoid this
>> helper-that-shouldn't-exist-but-someone-hacked-it-in entirely?
>> If it makes sparc64 slightly slower #dontcare.
>
> I tried three ways of doing that on an Ultra 45 (UltraSPARC IIIi, two
> CPUs), all with move_pte() removed entirely:
>
> A) sparc64's flush_cache_range() flushes every present page in the
> range from the D-cache;
> B) sparc64's flush_cache_range() flushes the whole D-cache;
> C) A for ranges of up to 10 pages, B above that.
>
> All three pass a test that moves pages between cache colors with
> mremap() and checks for stale data. With no flush at all the same test
> finds about 15 million stale words per run, so it does catch the
> problem.
>
> Medians of 20 runs over two boots per kernel, against this series'
> move_pte() as the baseline:
>
> move_pte() A B C
> apt-cache gencaches 6.63 s +0.2% +0.3% +0.1%
> fork+exec +0.7% +3.1% -0.6%
> mremap 8K, same color 14 us 20 us 43 us 20 us
> mremap 8K, other color 21 us 20 us 43 us 20 us
> mremap 1M, same color 30 us 524 us 60 us 59 us
> mremap 8M, same color 209 us 4152 us 229 us 227 us
> mremap 8M, other color 4176 us 4166 us 236 us 233 us
> mremap 8M THP, same color 14 us 3933 us 43 us 42 us
>
> flush_cache_range() has more callers than mremap(), mostly in rmap,
> so I also timed reclaim, migration and writeback (medians of 5):
>
> A B C
> MADV_PAGEOUT to swap +0.4% +12.9% -1.3%
> reclaim under memory.max +1.9% +17.7% +2.0%
> msync of shared file mappings -4.4% -3.4% -0.4%
> compaction, move_pages() within 3% for all three
>
> So A pays on large moves, B on reclaim, and C on neither: it costs
> the same as A on small ranges and the same as B on large ones. I'd go
> with C. It would only flush on Spitfire and Cheetah, which have the
> aliasing D-cache, so sun4v and the SPARC64 VII in Magnus's M3000
> series skip it.
>
> If that works for you, I'd suggest dropping 4/4 and using C as its
> replacement; it's below the scissors, on top of 1/4-3/4.
But that's too complicated, requiring page table walks ....
People running museum piece hardware and complaining about performance of mremap
or memory reclaim should reconsider life choices.
So I'd say, make it as slow as you want while reducing core-MM complexity and
not adding more arch complexity.
--
Cheers,
David
next prev parent reply other threads:[~2026-10-28 8:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 23:33 [PATCH v3 0/4] sparc64: D-cache alias flushing fixes Imre Kaloz
2026-10-21 23:33 ` [PATCH v3 1/4] sparc64: skip the trap block in xcall_deliver() when there is no target Imre Kaloz
2026-10-21 23:33 ` [PATCH v3 2/4] sparc64: flush only the aliased page, not its whole folio Imre Kaloz
2026-10-21 23:33 ` [PATCH v3 3/4] sparc64: flush vmalloc ranges from the D-cache on map and unmap Imre Kaloz
2026-10-21 23:33 ` [PATCH v3 4/4] mm: pass the number of PTEs to move_pte() Imre Kaloz
2026-10-23 17:17 ` Pedro Falcato
2026-10-23 20:53 ` David Hildenbrand (Arm)
2026-10-27 21:26 ` Imre Kaloz
2026-10-28 8:49 ` David Hildenbrand (Arm) [this message]
2026-10-28 9:16 ` Imre Kaloz
2026-10-28 9:22 ` David Hildenbrand (Arm)
2026-10-28 9:58 ` John Paul Adrian Glaubitz
2026-10-28 10:02 ` David Hildenbrand (Arm)
2026-10-28 10:12 ` Lorenzo Stoakes (ARM)
2026-10-28 10:17 ` Imre Kaloz
2026-10-28 13:57 ` Andreas Larsson
2026-10-28 13:59 ` David Hildenbrand (Arm)
2026-10-28 16:26 ` Imre Kaloz
2026-10-28 14:00 ` David Hildenbrand (Arm)
2026-10-22 8:20 ` [PATCH v3 0/4] sparc64: D-cache alias flushing fixes Stian Halseth
2026-10-23 9:22 ` Andreas Larsson
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=dfe06aef-540a-4450-88ba-300a460007b7@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andreas@gaisler.com \
--cc=davem@davemloft.net \
--cc=jannh@google.com \
--cc=kaloz@kernel.org \
--cc=liam@infradead.org \
--cc=linmag7@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=pfalcato@suse.de \
--cc=rppt@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=willy@infradead.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