From: Harry Yoo <harry.yoo@oracle.com>
To: alexjlzheng@gmail.com
Cc: mingo@redhat.com, tglx@linutronix.de, jroedel@suse.de,
linux@armlinux.org.uk, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, hpa@zytor.com, akpm@linux-foundation.org,
david@redhat.com, lorenzo.stoakes@oracle.com,
Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, urezki@gmail.com,
arnd@arndb.de, vincenzo.frascino@arm.com, geert@linux-m68k.org,
thuth@redhat.com, kas@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
joro@8bytes.org, Jinliang Zheng <alexjlzheng@tencent.com>
Subject: Re: [PATCH] mm: introduce ARCH_PAGE_TABLE_SYNC_MASK_VMALLOC to sync kernel mapping conditionally
Date: Thu, 18 Sep 2025 01:41:04 +0900 [thread overview]
Message-ID: <aMrkoBhIcP37YgyS@hyeyoo> (raw)
In-Reply-To: <20250917154829.2191671-1-alexjlzheng@tencent.com>
On Wed, Sep 17, 2025 at 11:48:29PM +0800, alexjlzheng@gmail.com wrote:
> From: Jinliang Zheng <alexjlzheng@tencent.com>
>
> After commit 6eb82f994026 ("x86/mm: Pre-allocate P4D/PUD pages for
> vmalloc area"), we don't need to synchronize kernel mappings in the
> vmalloc area on x86_64.
Right.
> And commit 58a18fe95e83 ("x86/mm/64: Do not sync vmalloc/ioremap
> mappings") actually does this.
Right.
> But commit 6659d0279980 ("x86/mm/64: define ARCH_PAGE_TABLE_SYNC_MASK
> and arch_sync_kernel_mappings()") breaks this.
Good point.
> This patch introduces ARCH_PAGE_TABLE_SYNC_MASK_VMALLOC to avoid
> unnecessary kernel mappings synchronization of the vmalloc area.
>
> Fixes: 6659d0279980 ("x86/mm/64: define ARCH_PAGE_TABLE_SYNC_MASK and arch_sync_kernel_mappings()")
The commit is getting backported to -stable kernels.
Do you think this can cause a visible performance regression from
user point of view, or it's just a nice optimization to have?
(and any data to support?)
> Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
> ---
> arch/arm/include/asm/page.h | 3 ++-
> arch/x86/include/asm/pgtable-2level_types.h | 3 ++-
> arch/x86/include/asm/pgtable-3level_types.h | 3 ++-
> include/linux/pgtable.h | 4 ++++
> mm/memory.c | 2 +-
> mm/vmalloc.c | 6 +++---
> 6 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 0ba4f6b71847..cd2488043f8f 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3170,7 +3170,7 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr,
> break;
> } while (pgd++, addr = next, addr != end);
>
> - if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
> + if (mask & ARCH_PAGE_TABLE_SYNC_MASK_VMALLOC)
> arch_sync_kernel_mappings(start, start + size);
But vmalloc is not the only user of apply_to_page_range()?
--
Cheers,
Harry / Hyeonggon
next prev parent reply other threads:[~2025-09-17 16:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 15:48 alexjlzheng
2025-09-17 16:41 ` Harry Yoo [this message]
2025-09-17 17:35 ` Harry Yoo
2025-09-18 1:31 ` Jinliang Zheng
2025-09-18 2:09 ` Harry Yoo
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=aMrkoBhIcP37YgyS@hyeyoo \
--to=harry.yoo@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=alexjlzheng@gmail.com \
--cc=alexjlzheng@tencent.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=geert@linux-m68k.org \
--cc=hpa@zytor.com \
--cc=joro@8bytes.org \
--cc=jroedel@suse.de \
--cc=kas@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@armlinux.org.uk \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=tglx@linutronix.de \
--cc=thuth@redhat.com \
--cc=urezki@gmail.com \
--cc=vbabka@suse.cz \
--cc=vincenzo.frascino@arm.com \
--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