From: Mike Rapoport <rppt@kernel.org>
To: Li Zhe <lizhe.67@bytedance.com>
Cc: akpm@linux-foundation.org, apopple@nvidia.com, arnd@arndb.de,
balbirs@nvidia.com, bp@alien8.de, dave.hansen@linux.intel.com,
david@kernel.org, kees@kernel.org, mingo@redhat.com,
muchun.song@linux.dev, tglx@kernel.org,
linux-arch@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org
Subject: Re: [PATCH v11 4/7] mm: extend the template fast path to zone-device compound tails
Date: Wed, 2 Sep 2026 07:18:56 +0300 [thread overview]
Message-ID: <apejsLXJGvV9sxOt@kernel.org> (raw)
In-Reply-To: <20260831111638.76012-5-lizhe.67@bytedance.com>
On Mon, Aug 31, 2026 at 07:16:35PM +0800, Li Zhe wrote:
> The template fast path from the previous patch only accelerates head
> pages. Compound tails in memmap_init_compound() still go through the
> normal initialization path one by one.
>
> Build separate head and tail templates and reuse one prepared tail
> template across the tail pages in a compound range. Head pages preserve
> the existing refcount policy, while compound tails always start with a
> refcount of 0 after prep_compound_tail().
>
> This extends the template-copy fast path to pfns_per_compound > 1.
> Tail-page PFN-dependent fields are refreshed in the reusable tail
> template before each copy.
>
> Do not keep a separate non-template fallback for compound tails either.
> These pages are still under memmap initialization, and the
> initialization-time refcount updates are not part of the observable
> lifetime of pages handed out later.
>
> The impact is controlled for the same reason as for head pages. The
> first tail page still seeds the reusable tail template through the
> normal tail initialization sequence, and the copied tail pages have the
> same final initialized state except for the PFN-dependent fields
> refreshed before each copy.
>
> Tested in a VM with a 100 GB devdax namespace (align=2097152) on Intel
> Ice Lake server. This test exercises the dax_pmem rebind path and
> measures memmap initialization latency.
>
> Test procedure:
> Unbind and rebind the dax_pmem driver 30 times, collect memmap
> initialization time from the pr_debug() output of
> memmap_init_zone_device().
>
> Base(v7.3-rc1):
> Average of rebinds for dax_pmem driver: 191.20 ms
>
> With this patch and its prerequisites applied:
> Average of rebinds for dax_pmem driver: 176.87 ms
>
> This reduces the average memmap initialization time measured during
> rebind from 191.20 ms to 176.87 ms, or about 7.5%.
>
> Signed-off-by: Li Zhe <lizhe.67@bytedance.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> mm/mm_init.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-09-02 4:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 11:16 [PATCH v11 0/7] mm: optimize zone-device memmap initialization Li Zhe
2026-08-31 11:16 ` [PATCH v11 1/7] mm: fix stale ZONE_DEVICE refcount comment Li Zhe
2026-08-31 11:16 ` [PATCH v11 2/7] mm: add a set_page_section_from_pfn() helper Li Zhe
2026-08-31 11:16 ` [PATCH v11 3/7] mm: add a template-based fast path for zone-device page init Li Zhe
2026-09-02 4:16 ` Mike Rapoport
2026-09-03 2:58 ` Li Zhe
2026-08-31 11:16 ` [PATCH v11 4/7] mm: extend the template fast path to zone-device compound tails Li Zhe
2026-09-02 4:18 ` Mike Rapoport [this message]
2026-08-31 11:16 ` [PATCH v11 5/7] string: introduce memcpy_nontemporal() Li Zhe
2026-08-31 11:16 ` [PATCH v11 6/7] mm: use memcpy_nontemporal() in zone-device template copies Li Zhe
2026-08-31 11:16 ` [PATCH v11 7/7] x86/string: extend memcpy_flushcache() fixed-size fastpaths Li Zhe
2026-08-31 23:45 ` [PATCH v11 0/7] mm: optimize zone-device memmap initialization Andrew Morton
2026-09-01 2:58 ` Li Zhe
2026-09-01 23:07 ` Andrew Morton
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=apejsLXJGvV9sxOt@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=arnd@arndb.de \
--cc=balbirs@nvidia.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=kees@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizhe.67@bytedance.com \
--cc=mingo@redhat.com \
--cc=muchun.song@linux.dev \
--cc=tglx@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