Subject: Re: [PATCH] arm64: clear_page[s] using memset

From: Catalin Marinas <[email-masked]>
Date: Thu, 2 Apr 2026 21:57:08 +0100

On Fri, Mar 06, 2026 at 09:57:50AM +0100, Linus Walleij wrote:
> There is no need to try to second-guess the compiler when
> clearing memory. Just call memset() like everyone else.

Hmm, that "like everyone else" made me think - why not move this to
generic code and only the 1-2 platforms that need their own should
override it? Could we do the same with copy_page()?

Sorry, more work all of a sudden ;).

> Since memset() already has an architecture-local MOPS
> optimization, we do not need to do anything else to preserve
> the MOPS optimization.

The custom clear_page() had the (very small) advantage that it can skip
the length/alignment checks as they are always page-size.

> While at it, implement the shorthand for directly calling
> the new prototype clear_pages() for larger page chunks.
> 
> No performance regressions can be seen, the fastpath
> benchmarks differences are in the noise.

I assume the benchmarks ran on real hardware (had to ask, last time you
mentioned qemu ;)).

-- 
Catalin