[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <377d74d6-a7f9-4e94-9276-168a26d49210@redhat.com>
Date: Fri, 11 Jul 2025 13:47:43 +0200
From: David Hildenbrand <david@...hat.com>
To: Ankur Arora <ankur.a.arora@...cle.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, x86@...nel.org
Cc: akpm@...ux-foundation.org, bp@...en8.de, dave.hansen@...ux.intel.com,
hpa@...or.com, mingo@...hat.com, mjguzik@...il.com, luto@...nel.org,
peterz@...radead.org, acme@...nel.org, namhyung@...nel.org,
tglx@...utronix.de, willy@...radead.org, raghavendra.kt@....com,
boris.ostrovsky@...cle.com, konrad.wilk@...cle.com
Subject: Re: [PATCH v5 10/14] x86/mm: Simplify clear_page_*
On 10.07.25 02:59, Ankur Arora wrote:
> clear_page_rep() and clear_page_erms() are wrappers around "REP; STOS"
> variations. Inlining gets rid of an unnecessary CALL/RET (which isn't
> free when using RETHUNK speculative execution mitigations.)
> Fixup and rename clear_page_orig() to adapt to the changed calling
> convention.
>
> And, add a comment from Dave Hansen detailing various clearing mechanisms
> used in clear_page().
>
> Signed-off-by: Ankur Arora <ankur.a.arora@...cle.com>
> ---
> arch/x86/include/asm/page_32.h | 6 +++++
> arch/x86/include/asm/page_64.h | 42 ++++++++++++++++++++++++++--------
> arch/x86/lib/clear_page_64.S | 39 +++++++------------------------
> 3 files changed, 46 insertions(+), 41 deletions(-)
>
> diff --git a/arch/x86/include/asm/page_32.h b/arch/x86/include/asm/page_32.h
> index 0c623706cb7e..a8ff43bb9652 100644
> --- a/arch/x86/include/asm/page_32.h
> +++ b/arch/x86/include/asm/page_32.h
> @@ -17,6 +17,12 @@ extern unsigned long __phys_addr(unsigned long);
>
> #include <linux/string.h>
>
> +/*
/** if this was supposed to be kernel doc (which it looks like it is)
> + * clear_page() - clear kernel page.
"clear a kernel page"
Although I am not sure what a "kernel page" is.
Did you mean "clear a page using a kernel virtual address" ?
(we have a handful of "kernel page" usages, where we talk about non-user
space allocations)
> + * @page: address of kernel page
> + *
> + * Does absolutely no exception handling.
> + */
> static inline void clear_page(void *page)
> {
> memset(page, 0, PAGE_SIZE);
> diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h
> index 015d23f3e01f..28b9adbc5f00 100644
> --- a/arch/x86/include/asm/page_64.h
> +++ b/arch/x86/include/asm/page_64.h
> @@ -40,23 +40,45 @@ extern unsigned long __phys_addr_symbol(unsigned long);
>
> #define __phys_reloc_hide(x) (x)
>
> -void clear_page_orig(void *page);
> -void clear_page_rep(void *page);
> -void clear_page_erms(void *page);
> +void memzero_page_aligned_unrolled(void *addr, u64 len);
>
> +/*
> + * clear_page() - clear kernel page.> + * @page: address of kernel page
Same comment as above.
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists