Re: [PATCH v8 4/7] x86/mm: Simplify clear_page_*

From: Borislav Petkov

Date: Tue Oct 28 2025 - 09:37:27 EST


On Mon, Oct 27, 2025 at 01:21:06PM -0700, Ankur Arora wrote:
> +/**
> + * clear_page() - clear a page using a kernel virtual address.
> + * @addr: address of kernel page
> + *
> + * Switch between three implementations of page clearing based on CPU
> + * capabilities:
> + *
> + * - memzero_page_aligned_unrolled(): the oldest, slowest and universally

So I don't see how a memzero_<bla> name shows that it belongs to the
clear_page "stack" of functions? clear_page_orig() kinda conveys better what
this thing is. In any case, having "clear_page" somewhere there in the name
should stay.

> + * supported method. Zeroes via 8-byte MOV instructions unrolled 8x
> + * to write a 64-byte cacheline in each loop iteration..
^

one fullstop is enough.

> + *
> + * - "rep stosq": really old CPUs had crummy REP implementations.

We spell all x86 insns in ALL CAPS. Like you've almost done.

Also, it is

REP; STOSQ

with a ;

Otherwise the idea for the cleanup makes sense.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette