Re: [PATCH v3] mm/memory: drop PROCESS_PAGES_NON_PREEMPT_BATCH
From: Garg, Shivank
Date: Mon Nov 09 2026 - 23:17:01 EST
On Mon, 2026-11-09 at 23:00 +0100, David Hildenbrand (Arm) wrote:
> On 11/9/26 20:15, Shivank Garg wrote:
> > clear_contig_highpages() clears the whole range at once under
> > preemptible models. Otherwise it clears PROCESS_PAGES_NON_PREEMPT_BATCH
> > pages at a time, with a cond_resched() in between. The batch is 32MB if
> > the architecture defines clear_pages(), and one page otherwise.
> >
> > Since commit 7dadeaa6e851 ("sched: Further restrict the preemption
> > modes"), architectures that support lazy preemption only offer the
> > full, lazy and RT preemption models, also with PREEMPT_DYNAMIC. x86 is
> > one of them, and it is the only architecture that defines
> > clear_pages(). So the 32MB batch is never used: whenever
> > clear_contig_highpages() runs under a cooperative model, the batch is
> > one page.
> >
> > Make that explicit. Clear the whole range when CONFIG_PREEMPTION is
> > set, and one page at a time with cond_resched() in between otherwise.
> > Drop PROCESS_PAGES_NON_PREEMPT_BATCH, which has no other users.
> >
> > PREEMPT_DYNAMIC kernels also have CONFIG_PREEMPTION set, and
> > cond_resched() does nothing on any of these kernels. So a build-time
> > CONFIG_PREEMPTION check is enough, and preempt_model_preemptible() is
> > not needed.
> >
> > No functional change intended.
> >
> > Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
> > Reviewed-by: Pedro Falcato <pfalcato@xxxxxxx>
> > Signed-off-by: Shivank Garg <shivankg@xxxxxxx>
> > ---
> >
>
> Thanks, I'll wait a bit for more review before applying.
>
> Reviewed-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
Thanks, David, for the review.
Once this is final, I'll work on the next version of the batch copy
in folio_mc_copy() [1]. :)
[1] https://lore.kernel.org/linux-mm/20261019-batpagecopy-v2-1-d75e7d0dfaae@xxxxxxx/
Regards,
Shivank