From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Pedro Falcato <pfalcato@suse.de>, Shivank Garg <shivankg@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.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>, Borislav Petkov <bp@alien8.de>,
Ankur Arora <ankur.a.arora@oracle.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@kernel.org>,
Bharata B Rao <bharata@amd.com>,
Hrushikesh Salunke <hsalunke@amd.com>,
Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
David Laight <david.laight.linux@gmail.com>,
David Rientjes <rientjes@google.com>,
Linus Torvalds <torvalds@linuxfoundation.org>,
Teja Vojjala <tejavojjala@google.com>,
Huan Nguyen <nhuhuan@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH RFC v2] mm: introduce copy_mc_highpages() and batch copy in folio_mc_copy()
Date: Mon, 19 Oct 2026 14:23:21 +0200 [thread overview]
Message-ID: <ad34dd6d-f106-42b1-b8b6-a4487822285f@kernel.org> (raw)
In-Reply-To: <atX3lpXQBHH1JPhW@pedro-suse.tail5790ac.ts.net>
>> +}
>> +#else
>> +
>> +#define COPY_MC_PAGES_NON_PREEMPT_BATCH 1
>
> I would suggest that perhaps this should be the fallback for non-preemptible
> models. But it gets a little weird with PREEMPT_DYNAMIC I think?
Why can't we just use PROCESS_PAGES_NON_PREEMPT_BATCH where we have similar
handling already?
>
>> +
>> +static inline int copy_mc_highpages(struct page *to, struct page *from,
>> + unsigned long nr_pages)
>> +{
>> + unsigned long i;
>> +
>> + for (i = 0; i < nr_pages; i++)
>> + if (copy_mc_highpage(to + i, from + i))
>> + return -EHWPOISON;
>> + return 0;
>> +}
>> +#endif
>> +
>> static inline void memcpy_page(struct page *dst_page, size_t dst_off,
>> struct page *src_page, size_t src_off,
>> size_t len)
>> diff --git a/mm/util.c b/mm/util.c
>> index 7f374bb8bf36..5015cfdfeaa5 100644
>> --- a/mm/util.c
>> +++ b/mm/util.c
>> @@ -763,13 +763,23 @@ EXPORT_SYMBOL(folio_copy);
>>
>> int folio_mc_copy(struct folio *dst, struct folio *src)
>> {
>> - long nr = folio_nr_pages(src);
>> - long i = 0;
>> + const unsigned long nr_pages = folio_nr_pages(src);
>> + /*
>> + * Copy the largest extent possible to allow for architecture specific
>> + * extent based optimizations. copy_mc_highpages() does not call
>> + * cond_resched(), so limit the unit size when running under
>> + * non-preemptible scheduling models.
>> + */
>> + const unsigned long unit = preempt_model_preemptible() ?
>> + nr_pages : COPY_MC_PAGES_NON_PREEMPT_BATCH;
>
> See? now mm is aware of preemption models! eww!
Yeah, we have that in clear_contig_highpages() already, which is getting
replicated here for copying instead of zeroing.
--
Cheers,
David
next prev parent reply other threads:[~2026-10-19 12:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 10:06 Shivank Garg
2026-10-19 11:09 ` Pedro Falcato
2026-10-19 12:23 ` David Hildenbrand (Arm) [this message]
2026-10-19 13:10 ` Garg, Shivank
2026-10-19 14:21 ` David Hildenbrand (Arm)
2026-10-19 17:32 ` Garg, Shivank
2026-10-19 13:16 ` Garg, Shivank
2026-10-19 12:19 ` David Laight
2026-10-19 18:54 ` Garg, Shivank
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=ad34dd6d-f106-42b1-b8b6-a4487822285f@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ankur.a.arora@oracle.com \
--cc=bharata@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david.laight.linux@gmail.com \
--cc=hpa@zytor.com \
--cc=hsalunke@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=mingo@redhat.com \
--cc=nhuhuan@google.com \
--cc=pfalcato@suse.de \
--cc=rientjes@google.com \
--cc=rppt@kernel.org \
--cc=shivankg@amd.com \
--cc=surenb@google.com \
--cc=tejavojjala@google.com \
--cc=tglx@kernel.org \
--cc=torvalds@linuxfoundation.org \
--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®