linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: David Hildenbrand <david@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Matthew Brost <matthew.brost@intel.com>,
	Joshua Hahn <joshua.hahnjy@gmail.com>,
	Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
	Gregory Price <gourry@gourry.net>,
	Ying Huang <ying.huang@linux.alibaba.com>,
	Alistair Popple <apopple@nvidia.com>,
	Pedro Falcato <pfalcato@suse.de>, Rik van Riel <riel@surriel.com>,
	Harry Yoo <harry.yoo@oracle.com>,
	Lance Yang <ioworker0@gmail.com>,
	Oscar Salvador <osalvador@suse.de>
Subject: Re: [PATCH v2 3/4] mm: split folio_pte_batch() into folio_pte_batch() and folio_pte_batch_flags()
Date: Wed, 02 Jul 2025 10:25:52 -0400	[thread overview]
Message-ID: <42BA6F99-8DCD-41EF-87E9-A538FACD15D4@nvidia.com> (raw)
In-Reply-To: <20250702104926.212243-4-david@redhat.com>

On 2 Jul 2025, at 6:49, David Hildenbrand wrote:

> Many users (including upcoming ones) don't really need the flags etc,
> and can live with the possible overhead of a function call.
>
> So let's provide a basic, non-inlined folio_pte_batch(), to avoid code
> bloat while still providing a variant that optimizes out all flag
> checks at runtime. folio_pte_batch_flags() will get inlined into
> folio_pte_batch(), optimizing out any conditionals that depend on input
> flags.
>
> folio_pte_batch() will behave like folio_pte_batch_flags() when no
> flags are specified. It's okay to add new users of
> folio_pte_batch_flags(), but using folio_pte_batch() if applicable is
> preferred.
>
> So, before this change, folio_pte_batch() was inlined into the C file
> optimized by propagating constants within the resulting object file.
>
> With this change, we now also have a folio_pte_batch() that is
> optimized by propagating all constants. But instead of having one instance
> per object file, we have a single shared one.
>
> In zap_present_ptes(), where we care about performance, the compiler
> already seem to generate a call to a common inlined folio_pte_batch()
> variant, shared with fork() code. So calling the new non-inlined variant
> should not make a difference.
>
> While at it, drop the "addr" parameter that is unused.
>
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> Link: https://lore.kernel.org/linux-mm/20250503182858.5a02729fcffd6d4723afcfc2@linux-foundation.org/
> Reviewed-by: Oscar Salvador <osalvador@suse.de>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  mm/internal.h  | 11 ++++++++---
>  mm/madvise.c   |  4 ++--
>  mm/memory.c    |  8 +++-----
>  mm/mempolicy.c |  3 +--
>  mm/mlock.c     |  3 +--
>  mm/mremap.c    |  3 +--
>  mm/rmap.c      |  3 +--
>  mm/util.c      | 29 +++++++++++++++++++++++++++++
>  8 files changed, 46 insertions(+), 18 deletions(-)
>
Reviewed-by: Zi Yan <ziy@nvidia.com>

Best Regards,
Yan, Zi


  reply	other threads:[~2025-07-02 14:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 10:49 [PATCH v2 0/4] mm: folio_pte_batch() improvements David Hildenbrand
2025-07-02 10:49 ` [PATCH v2 1/4] mm: convert FPB_IGNORE_* into FPB_RESPECT_* David Hildenbrand
2025-07-03 10:05   ` Dev Jain
2025-07-02 10:49 ` [PATCH v2 2/4] mm: smaller folio_pte_batch() improvements David Hildenbrand
2025-07-02 14:24   ` Zi Yan
2025-07-03 10:18   ` Dev Jain
2025-07-02 10:49 ` [PATCH v2 3/4] mm: split folio_pte_batch() into folio_pte_batch() and folio_pte_batch_flags() David Hildenbrand
2025-07-02 14:25   ` Zi Yan [this message]
2025-07-03 10:45   ` Dev Jain
2025-07-02 10:49 ` [PATCH v2 4/4] mm: remove boolean output parameters from folio_pte_batch_ext() David Hildenbrand
2025-07-02 14:00   ` Oscar Salvador
2025-07-02 14:40     ` David Hildenbrand
2025-07-02 17:53       ` Oscar Salvador
2025-07-03  9:16   ` Oscar Salvador
2025-07-03 12:56   ` Dev Jain
2025-08-04  8:22   ` Wei Yang
2025-08-04  8:23     ` David Hildenbrand

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=42BA6F99-8DCD-41EF-87E9-A538FACD15D4@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=byungchul@sk.com \
    --cc=david@redhat.com \
    --cc=gourry@gourry.net \
    --cc=harry.yoo@oracle.com \
    --cc=ioworker0@gmail.com \
    --cc=jannh@google.com \
    --cc=joshua.hahnjy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=pfalcato@suse.de \
    --cc=rakie.kim@sk.com \
    --cc=riel@surriel.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=ying.huang@linux.alibaba.com \
    /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