From: Peter Zijlstra <peterz@infradead.org>
To: Shivank Garg <shivankg@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Ankur Arora <ankur.a.arora@oracle.com>,
Pedro Falcato <pfalcato@suse.de>, Borislav Petkov <bp@alien8.de>,
Bharata B Rao <bharata@amd.com>,
Hrushikesh Salunke <hsalunke@amd.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] mm/memory: drop PROCESS_PAGES_NON_PREEMPT_BATCH
Date: Wed, 11 Nov 2026 13:40:06 +0100 [thread overview]
Message-ID: <20261111124006.GI2668564@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261109-clear-pages-batch-v3-1-6693efe18dff@amd.com>
On Mon, Nov 09, 2026 at 07:15:51PM +0000, Shivank Garg wrote:
> static void clear_contig_highpages(struct page *page, unsigned long addr,
> + unsigned int nr_pages)
> {
> + unsigned int i;
> +
> + might_sleep();
> +
> /*
> * When clearing we want to operate on the largest extent possible to
> * allow for architecture specific extent based optimizations.
> *
> + * clear_user_highpages() (and primitives clear_user_pages(),
> + * clear_pages()) do not call cond_resched(). That is fine on
> + * preemptible kernels, where the scheduler can preempt the clearing
> + * at any point, so clear the whole range at once. Otherwise, clear
> + * one page at a time and reschedule in between.
> */
> + if (IS_ENABLED(CONFIG_PREEMPTION)) {
> + clear_user_highpages(page, addr, nr_pages);
> + return;
> + }
>
> + for (i = 0; i < nr_pages; i++) {
FWIW one could do:
for (int i = 0; i < nr_pages; i++) {
and forgo the earlier variable declaration.
> cond_resched();
> + clear_user_highpage(page + i, addr + i * PAGE_SIZE);
> }
> }
prev parent reply other threads:[~2026-11-11 12:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 19:15 Shivank Garg
2026-11-09 22:00 ` David Hildenbrand (Arm)
2026-11-10 4:16 ` Garg, Shivank
2026-11-10 15:06 ` Lorenzo Stoakes (ARM)
2026-11-11 9:30 ` David Hildenbrand
2026-11-11 12:40 ` Peter Zijlstra [this message]
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=20261111124006.GI2668564@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=ankur.a.arora@oracle.com \
--cc=bharata@amd.com \
--cc=bp@alien8.de \
--cc=david@kernel.org \
--cc=hsalunke@amd.com \
--cc=kprateek.nayak@amd.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=pfalcato@suse.de \
--cc=rppt@kernel.org \
--cc=shivankg@amd.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®