From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
mm-commits@vger.kernel.org, vbabka@kernel.org,
torvalds@linuxfoundation.org, tglx@kernel.org,
tejavojjala@google.com, surenb@google.com, rppt@kernel.org,
rientjes@google.com, pfalcato@suse.de, peterz@infradead.org,
nhuhuan@google.com, mingo@redhat.com, mhocko@suse.com,
ljs@kernel.org, liam@infradead.org, hsalunke@amd.com,
hpa@zytor.com, david.laight.linux@gmail.com,
dave.hansen@linux.intel.com, bp@alien8.de, bharata@amd.com,
ankur.a.arora@oracle.com, shivankg@amd.com
Subject: Re: + mm-introduce-copy_mc_highpages-and-batch-copy-in-folio_mc_copy.patch added to mm-unstable branch
Date: Sun, 22 Nov 2026 17:00:47 +0100 [thread overview]
Message-ID: <4587b2d8-2aaa-481e-babc-8901423faf11@kernel.org> (raw)
In-Reply-To: <20261122073025.90A441F000C0@smtp.kernel.org>
On 11/22/26 08:30, Andrew Morton wrote:
> The patch titled
> Subject: mm: introduce copy_mc_highpages() and batch copy in folio_mc_copy()
> has been added to the -mm mm-unstable branch. Its filename is
> mm-introduce-copy_mc_highpages-and-batch-copy-in-folio_mc_copy.patch
>
> This patch will shortly appear at
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-introduce-copy_mc_highpages-and-batch-copy-in-folio_mc_copy.patch
>
> This patch will later appear in the mm-unstable branch at
> git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next via various
> branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there most days
>
> ------------------------------------------------------
> From: Shivank Garg <shivankg@amd.com>
> Subject: mm: introduce copy_mc_highpages() and batch copy in folio_mc_copy()
> Date: Fri, 13 Nov 2026 17:09:21 +0000
>
> folio_mc_copy() copies a folio one page at a time with copy_mc_highpage(),
> so a 2MB folio makes 512 separate copy_mc_to_kernel() calls. Each page
> pays the startup cost of the string instruction ("REP; MOVSB" on x86 CPUs
> with ERMS) plus a cond_resched().
>
> Introduce copy_mc_highpages(), the page range variant of
> copy_mc_highpage(). When copy_mc_to_kernel() is available and the pages
> are in the linear map, copy the whole range with a single
> copy_mc_to_kernel() call, so the CPU can optimize for the larger extent.
> Otherwise, fall back to copy_mc_highpage() one page at a time.
>
> On a machine check, queue the poisoned source page for memory_failure(),
> as copy_mc_highpage() does, and return -EHWPOISON, as folio_mc_copy() does
> today.
>
> copy_mc_to_kernel() cannot reschedule, so only take the single-call path
> when CONFIG_PREEMPTION is set and the copy can be preempted. Since commit
> 7dadeaa6e851 ("sched: Further restrict the preemption modes"), x86 and
> powerpc, the only architectures that select ARCH_HAS_COPY_MC, only offer
> the full, lazy and RT preemption models, also with PREEMPT_DYNAMIC, so
> they always take this path. The per-page fallback calls cond_resched()
> before each page, as clear_contig_highpages() does. Other architectures
> keep copying one page at a time.
>
> Switch folio_mc_copy() to copy the whole folio with copy_mc_highpages().
>
> On a Zen 6 system with CXL memory, move_pages() gets ~1.4x faster for 2MB
> THPs and up to ~2.8x faster for 1GB hugetlb pages (numbers below). When
> demoting to CXL, kswapd uses ~31% less CPU per GB demoted.
Hi Andrew,
please drop it. I'll take care of it once we have more review (including review
from me).
--
Cheers,
David
next prev parent reply other threads:[~2026-11-22 16:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 17:09 [PATCH v3] mm: introduce copy_mc_highpages() and batch copy in folio_mc_copy() Shivank Garg
2026-11-14 17:12 ` sashiko-bot
2026-11-17 5:27 ` Garg, Shivank
2026-11-19 17:27 ` David Hildenbrand (Arm)
2026-11-22 7:30 ` Andrew Morton
2026-11-22 17:13 ` Garg, Shivank
2026-11-22 7:30 ` + mm-introduce-copy_mc_highpages-and-batch-copy-in-folio_mc_copy.patch added to mm-unstable branch Andrew Morton
2026-11-22 16:00 ` David Hildenbrand (Arm) [this message]
2026-11-22 16:44 ` [merged] mm-introduce-copy_mc_highpages-and-batch-copy-in-folio_mc_copy.patch removed from -mm tree Andrew Morton
2026-11-23 16:23 ` [PATCH v3] mm: introduce copy_mc_highpages() and batch copy in folio_mc_copy() David Hildenbrand (Arm)
2026-11-26 18:44 ` Garg, Shivank
2026-11-26 20:43 ` David Hildenbrand (Arm)
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=4587b2d8-2aaa-481e-babc-8901423faf11@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=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=mm-commits@vger.kernel.org \
--cc=nhuhuan@google.com \
--cc=peterz@infradead.org \
--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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.