From: Raghavendra K T <raghavendra.kt@amd.com>
To: "Salunke, Hrushikesh" <hsalunke@amd.com>,
"Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
akpm@linux-foundation.org, surenb@google.com, mhocko@suse.com,
jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
bharata@amd.com, ankur.a.arora@oracle.com, shivankg@amd.com,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH] mm/page_alloc: use batch page clearing in kernel_init_pages()
Date: Wed, 8 Apr 2026 21:54:51 +0530 [thread overview]
Message-ID: <938cf77e-6b66-4a89-b0af-d9126d497b8d@amd.com> (raw)
In-Reply-To: <aceb0077-b206-4484-b102-07de537dcb1e@amd.com>
On 4/8/2026 4:46 PM, Raghavendra K T wrote:
>
>
> On 4/8/2026 4:14 PM, Salunke, Hrushikesh wrote:
>> [Some people who received this message don't often get email from
>> hsalunke@amd.com. Learn why this is important at https://aka.ms/
>> LearnAboutSenderIdentification ]
>>
[...]
>>>> mm/page_alloc.c | 19 +++++++++++++++++--
>>>> 1 file changed, 17 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>>> index b1c5430cad4e..178cbebadd50 100644
>>>> --- a/mm/page_alloc.c
>>>> +++ b/mm/page_alloc.c
>>>> @@ -1224,8 +1224,23 @@ static void kernel_init_pages(struct page
>>>> *page, int numpages)
>>>>
>>>> /* s390's use of memset() could override KASAN redzones. */
>>>> kasan_disable_current();
>>>> - for (i = 0; i < numpages; i++)
>>>> - clear_highpage_kasan_tagged(page + i);
>>>> +
>>>> + if (!IS_ENABLED(CONFIG_HIGHMEM)) {
>>>> + void *addr = kasan_reset_tag(page_address(page));
>>>> + unsigned int unit = preempt_model_preemptible() ?
>>>> + numpages :
>>>> PROCESS_PAGES_NON_PREEMPT_BATCH;
>>>> + int count;
>>>> +
>>>> + for (i = 0; i < numpages; i += count) {
>>>> + cond_resched();
>
> Just thinking,
> Considering that for preemptible kernel/preempt_auto preempt_count()
> knows about preemption points to decide where it can preempt,
>
> and
>
> for non_preemptible kernel and voluntary kernel it is safe to do
> preemption at PROCESS_PAGES_NON_PREEMPT_BATCH granularity
s/preemption/clear_page/
> do we need cond_resched() here ?
>
> Let me know if I am missing something.
>
I do see Andrew also has same thoughts, (to remove cond_resched() and
sorry for being not crisp :))
But please ensure you test with the below configs to ensure there are no
surprises viz., preempt=none,voluntary,full(/auto).
Regards
- Raghu
next prev parent reply other threads:[~2026-04-08 16:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 9:24 Hrushikesh Salunke
2026-04-08 9:47 ` Vlastimil Babka (SUSE)
2026-04-08 10:44 ` Salunke, Hrushikesh
2026-04-08 10:53 ` David Hildenbrand (Arm)
2026-04-08 11:16 ` Raghavendra K T
2026-04-08 16:24 ` Raghavendra K T [this message]
2026-04-08 15:32 ` Andrew Morton
2026-04-08 11:32 ` [syzbot ci] " syzbot ci
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=938cf77e-6b66-4a89-b0af-d9126d497b8d@amd.com \
--to=raghavendra.kt@amd.com \
--cc=akpm@linux-foundation.org \
--cc=ankur.a.arora@oracle.com \
--cc=bharata@amd.com \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=hsalunke@amd.com \
--cc=jackmanb@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=shivankg@amd.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.com \
/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