mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li Zhe" <lizhe.67@bytedance.com>
To: <rppt@kernel.org>
Cc: <akpm@linux-foundation.org>, <apopple@nvidia.com>,
	<arnd@arndb.de>,  <bp@alien8.de>, <dave.hansen@linux.intel.com>,
	<david@kernel.org>,  <kees@kernel.org>,
	<linux-arch@vger.kernel.org>,  <linux-hardening@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,  <linux-mm@kvack.org>,
	<lizhe.67@bytedance.com>, <mingo@redhat.com>,  <tglx@kernel.org>,
	<x86@kernel.org>
Subject: Re: [PATCH v2 7/7] mm: use memcpy_streaming() in zone-device template copies
Date: Mon, 25 May 2026 12:59:31 +0800	[thread overview]
Message-ID: <20260525045931.2136-1-lizhe.67@bytedance.com> (raw)
In-Reply-To: <177953825222.3959652.3741865801916579097.b4-review@b4>

On Sat, 23 May 2026 15:10:52 +0300, rppt@kernel.org wrote:

> On Thu, 21 May 2026 12:01:24 +0800, Li Zhe <lizhe.67@bytedance.com> wrote:
> > diff --git a/mm/mm_init.c b/mm/mm_init.c
> > index 17a84d4cda01..08feb24795b8 100644
> > --- a/mm/mm_init.c
> > +++ b/mm/mm_init.c
> > @@ -1075,13 +1075,15 @@ static void __ref zone_device_page_init_slow(struct page *page,
> > [ ... skip 12 lines ... ]
> >  	 */
> > -	return !page_ref_tracepoint_active(page_ref_set) &&
> > -		IS_ALIGNED(sizeof(struct page), sizeof(u64));
> > +	return !IS_ENABLED(CONFIG_KASAN) && !IS_ENABLED(CONFIG_KMSAN) &&
> > +	       !page_ref_tracepoint_active(page_ref_set) &&
> > +	       IS_ALIGNED(sizeof(struct page), sizeof(u64));
> 
> Oh, can we rewrite it as a sequence of
> 
> 	if (cond)
> 		return false;
> 	...
> 
> 	return true;
> 
> I believe the compilers would generate the same code.

Thanks for the review. I will fix this in the next revision.

> > @@ -1104,30 +1106,42 @@ static inline void zone_device_template_tail_page_init(struct page *template,
> > [ ... skip 10 lines ... ]
> > + * copying it into @page.
> >   */
> > -static inline void zone_device_page_init_finish(struct page *page,
> > -							unsigned long pfn)
> > +static inline void zone_device_page_update_template(struct page *template,
> > +						    unsigned long pfn)
> 
> Two tabs for indentation here from the first patch this function
> appears please.

Thanks for the review. I will fix this in the next revision.

> Why do we need the intermediate step of _init_finish() if we later
> change it to _update_template()?

Instead of introducing an intermediate _init_finish() and renaming it
later, I will simply use zone_device_page_update_template() directly
from the beginning in the patch series.

> > [ ... skip 30 lines ... ]
> > +		memcpy(page, template, sizeof(*page));
> > +	else
> > +		memcpy_streaming(page, template, sizeof(*page));
> >
> > -	for (i = 0; i < sizeof(struct page) / sizeof(u64); i++)
> > -		dst[i] = src[i];
> 
> If you replace this with memcpy, what's the point for doing the loop in
> intermediate patches?

Thanks for the review. I will fix this in the next revision.

Thanks,
Zhe

  reply	other threads:[~2026-05-25  4:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  4:01 [PATCH v2 0/7] mm: speed up ZONE_DEVICE memmap initialization Li Zhe
2026-05-21  4:01 ` [PATCH v2 1/7] mm: factor zone-device page init helpers out of __init_zone_device_page Li Zhe
2026-05-23 12:10   ` Mike Rapoport
2026-05-25  3:51     ` Li Zhe
2026-05-21  4:01 ` [PATCH v2 2/7] mm: add a set_page_section_from_pfn() helper Li Zhe
2026-05-23 12:10   ` Mike Rapoport
2026-05-21  4:01 ` [PATCH v2 3/7] mm: add a template-based fast path for zone-device page init Li Zhe
2026-05-23 12:10   ` Mike Rapoport
2026-05-25  4:02     ` Li Zhe
2026-05-21  4:01 ` [PATCH v2 4/7] mm: extend the template fast path to zone-device compound tails Li Zhe
2026-05-23 12:10   ` Mike Rapoport
2026-05-25  4:11     ` Li Zhe
2026-05-21  4:01 ` [PATCH v2 5/7] string: introduce memcpy_streaming() helpers Li Zhe
2026-05-21  4:01 ` [PATCH v2 6/7] x86/string: extend memcpy_flushcache() fixed-size fastpaths Li Zhe
2026-05-21  4:01 ` [PATCH v2 7/7] mm: use memcpy_streaming() in zone-device template copies Li Zhe
2026-05-23 12:10   ` Mike Rapoport
2026-05-25  4:59     ` Li Zhe [this message]
2026-05-21 22:20 ` [PATCH v2 0/7] mm: speed up ZONE_DEVICE memmap initialization Andrew Morton
2026-05-22  7:49   ` Li Zhe

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=20260525045931.2136-1-lizhe.67@bytedance.com \
    --to=lizhe.67@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=arnd@arndb.de \
    --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=mingo@redhat.com \
    --cc=rppt@kernel.org \
    --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

all inboxes | Powered by JetHome®