[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cbe123da-b433-4c91-8cb1-7b19826939b2@redhat.com>
Date: Tue, 23 Sep 2025 10:14:18 +0200
From: David Hildenbrand <david@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Ankur Arora <ankur.a.arora@...cle.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org, x86@...nel.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 v7 13/16] mm: memory: support clearing page ranges
On 17.09.25 23:44, Andrew Morton wrote:
> On Wed, 17 Sep 2025 08:24:15 -0700 Ankur Arora <ankur.a.arora@...cle.com> wrote:
>
>> Change folio_zero_user() to clear contiguous page ranges instead of
>> clearing using the current page-at-a-time approach. Exposing the largest
>> feasible length can be useful in enabling processors to optimize based
>> on extent.
>
> This patch is something which MM developers might care to take a closer
> look at.
I took a look at various revisions of this series, I'm only lagging
behind on reviewing the latest series :)
>
>> However, clearing in large chunks can have two problems:
>>
>> - cache locality when clearing small folios (< MAX_ORDER_NR_PAGES)
>> (larger folios don't have any expectation of cache locality).
>>
>> - preemption latency when clearing large folios.
>>
>> Handle the first by splitting the clearing in three parts: the
>> faulting page and its immediate locality, its left and right
>> regions; with the local neighbourhood cleared last.
>
> Has this optimization been shown to be beneficial?
>
> If so, are you able to share some measurements?
>
> If not, maybe it should be removed?
>
>> ...
>>
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -7021,40 +7021,80 @@ static inline int process_huge_page(
>> return 0;
>> }
>>
>> -static void clear_gigantic_page(struct folio *folio, unsigned long addr_hint,
>> - unsigned int nr_pages)
>> +/*
>> + * Clear contiguous pages chunking them up when running under
>> + * non-preemptible models.
>> + */
>> +static void clear_contig_highpages(struct page *page, unsigned long addr,
>> + unsigned int npages)
>
> Called "_highpages" because it wraps clear_user_highpages(). It really
> should be called clear_contig_user_highpages() ;) (Not serious)
You have a point there, though :)
Fortunately this is only an internal helper.
--
Cheers
David / dhildenb
Powered by blists - more mailing lists