From: Harry Yoo <harry.yoo@oracle.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Russell King <linux@armlinux.org.uk>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
"David S . Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Kees Cook <kees@kernel.org>, Peter Xu <peterx@redhat.com>,
David Hildenbrand <david@redhat.com>, Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Nico Pache <npache@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>, Xu Xin <xu.xin16@zte.com.cn>,
Chengming Zhou <chengming.zhou@linux.dev>,
Hugh Dickins <hughd@google.com>, Vlastimil Babka <vbabka@suse.cz>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Rik van Riel <riel@surriel.com>,
Dan Williams <dan.j.williams@intel.com>,
Matthew Wilcox <willy@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
John Hubbard <jhubbard@nvidia.com>,
Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>,
Qi Zheng <zhengqi.arch@bytedance.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
Uladzislau Rezki <urezki@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
kvm@vger.kernel.org, sparclinux@vger.kernel.org,
linux-sgx@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, nvdimm@lists.linux.dev,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm: update core kernel code to use vm_flags_t consistently
Date: Tue, 29 Jul 2025 09:15:51 +0900 [thread overview]
Message-ID: <aIgSpAnU8EaIcqd9@hyeyoo> (raw)
In-Reply-To: <d1588e7bb96d1ea3fe7b9df2c699d5b4592d901d.1750274467.git.lorenzo.stoakes@oracle.com>
On Wed, Jun 18, 2025 at 08:42:53PM +0100, Lorenzo Stoakes wrote:
> The core kernel code is currently very inconsistent in its use of
> vm_flags_t vs. unsigned long. This prevents us from changing the type of
> vm_flags_t in the future and is simply not correct, so correct this.
>
> While this results in rather a lot of churn, it is a critical pre-requisite
> for a future planned change to VMA flag type.
>
> Additionally, update VMA userland tests to account for the changes.
>
> To make review easier and to break things into smaller parts, driver and
> architecture-specific changes is left for a subsequent commit.
>
> The code has been adjusted to cascade the changes across all calling code
> as far as is needed.
>
> We will adjust architecture-specific and driver code in a subsequent patch.
>
> Overall, this patch does not introduce any functional change.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
[Adding Uladzislau to Cc]
Hi Lorenzo, just wanted to clarify one thing.
You know, many people acked and reviewed it, which makes me wonder if
I'm misunderstanding something... but it wouldn't hurt to check, right?
> diff --git a/mm/execmem.c b/mm/execmem.c
> index 9720ac2dfa41..bd95ff6a1d03 100644
> --- a/mm/execmem.c
> +++ b/mm/execmem.c
> @@ -26,7 +26,7 @@ static struct execmem_info default_execmem_info __ro_after_init;
>
> #ifdef CONFIG_MMU
> static void *execmem_vmalloc(struct execmem_range *range, size_t size,
> - pgprot_t pgprot, unsigned long vm_flags)
> + pgprot_t pgprot, vm_flags_t vm_flags)
> {
> bool kasan = range->flags & EXECMEM_KASAN_SHADOW;
> gfp_t gfp_flags = GFP_KERNEL | __GFP_NOWARN;
Is it intentional to use vm_flags_t for vm_struct flags, not vma flags?
You didn't update the type of struct vm_struct.flags field and vm_flags
parameter in __vmalloc_node_range_noprof() (of MMU version in mm/vmalloc.c)
...which makes me suspect it's not intentional?
> @@ -82,7 +82,7 @@ struct vm_struct *execmem_vmap(size_t size)
> }
> #else
> static void *execmem_vmalloc(struct execmem_range *range, size_t size,
> - pgprot_t pgprot, unsigned long vm_flags)
> + pgprot_t pgprot, vm_flags_t vm_flags)
> {
> return vmalloc(size);
> }
ditto.
> @@ -284,7 +284,7 @@ void execmem_cache_make_ro(void)
>
> static int execmem_cache_populate(struct execmem_range *range, size_t size)
> {
> - unsigned long vm_flags = VM_ALLOW_HUGE_VMAP;
> + vm_flags_t vm_flags = VM_ALLOW_HUGE_VMAP;
> struct vm_struct *vm;
> size_t alloc_size;
> int err = -ENOMEM;
ditto.
> @@ -407,7 +407,7 @@ void *execmem_alloc(enum execmem_type type, size_t size)
> {
> struct execmem_range *range = &execmem_info->ranges[type];
> bool use_cache = range->flags & EXECMEM_ROX_CACHE;
> - unsigned long vm_flags = VM_FLUSH_RESET_PERMS;
> + vm_flags_t vm_flags = VM_FLUSH_RESET_PERMS;
> pgprot_t pgprot = range->pgprot;
> void *p;
ditto.
> diff --git a/mm/internal.h b/mm/internal.h
> index feda91c9b3f4..506c6fc8b6dc 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -1360,7 +1360,7 @@ int migrate_device_coherent_folio(struct folio *folio);
>
> struct vm_struct *__get_vm_area_node(unsigned long size,
> unsigned long align, unsigned long shift,
> - unsigned long flags, unsigned long start,
> + vm_flags_t vm_flags, unsigned long start,
> unsigned long end, int node, gfp_t gfp_mask,
> const void *caller);
ditto.
> diff --git a/mm/nommu.c b/mm/nommu.c
> index b624acec6d2e..87e1acab0d64 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -126,7 +126,7 @@ void *vrealloc_noprof(const void *p, size_t size, gfp_t flags)
>
> void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
> unsigned long start, unsigned long end, gfp_t gfp_mask,
> - pgprot_t prot, unsigned long vm_flags, int node,
> + pgprot_t prot, vm_flags_t vm_flags, int node,
> const void *caller)
> {
ditto.
> return __vmalloc_noprof(size, gfp_mask);
--
Cheers,
Harry / Hyeonggon
next prev parent reply other threads:[~2025-07-29 0:18 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 19:42 [PATCH 0/3] use vm_flags_t consistently Lorenzo Stoakes
2025-06-18 19:42 ` [PATCH 1/3] mm: change vm_get_page_prot() to accept vm_flags_t argument Lorenzo Stoakes
2025-06-19 8:42 ` Christian Brauner
2025-06-19 8:49 ` Lorenzo Stoakes
2025-06-20 18:46 ` Pedro Falcato
2025-06-19 11:31 ` Vlastimil Babka
2025-06-19 12:18 ` Lorenzo Stoakes
2025-06-19 12:12 ` Oscar Salvador
2025-06-19 12:20 ` Lorenzo Stoakes
2025-06-19 12:25 ` Lorenzo Stoakes
2025-06-23 14:16 ` David Hildenbrand
2025-06-20 18:31 ` Pedro Falcato
2025-06-23 14:32 ` Zi Yan
2025-06-23 15:17 ` Catalin Marinas
2025-06-25 5:55 ` Anshuman Khandual
2025-06-18 19:42 ` [PATCH 2/3] mm: update core kernel code to use vm_flags_t consistently Lorenzo Stoakes
2025-06-18 21:17 ` Kees Cook
2025-06-19 7:44 ` Jan Kara
2025-06-19 8:37 ` Christian Brauner
2025-06-19 11:48 ` Vlastimil Babka
2025-06-19 12:06 ` Oscar Salvador
2025-06-20 18:49 ` Pedro Falcato
2025-06-23 14:17 ` David Hildenbrand
2025-06-23 14:33 ` Zi Yan
2025-06-25 6:00 ` Anshuman Khandual
2025-07-29 0:15 ` Harry Yoo [this message]
2025-07-29 5:25 ` Lorenzo Stoakes
2025-07-29 18:39 ` Uladzislau Rezki
2025-08-01 11:20 ` Lorenzo Stoakes
2025-08-04 10:54 ` Uladzislau Rezki
2025-08-05 9:37 ` Mike Rapoport
2025-08-05 16:13 ` Uladzislau Rezki
2025-08-25 21:37 ` Kees Cook
2025-08-27 16:59 ` Uladzislau Rezki
2025-06-18 19:42 ` [PATCH 3/3] mm: update architecture and driver code to use vm_flags_t Lorenzo Stoakes
2025-06-19 8:43 ` Christian Brauner
2025-06-19 11:48 ` Vlastimil Babka
2025-06-19 12:18 ` Oscar Salvador
2025-06-20 18:47 ` Pedro Falcato
2025-06-23 14:18 ` David Hildenbrand
2025-06-23 14:34 ` Zi Yan
2025-06-23 15:17 ` Catalin Marinas
2025-06-24 20:44 ` Jarkko Sakkinen
2025-06-25 6:08 ` Anshuman Khandual
2025-06-19 5:47 ` [PATCH 0/3] use vm_flags_t consistently Mike Rapoport
2025-06-25 2:55 ` Anshuman Khandual
2025-06-25 4:50 ` Andrew Morton
2025-06-25 6:47 ` Lorenzo Stoakes
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=aIgSpAnU8EaIcqd9@hyeyoo \
--to=harry.yoo@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=andreas@gaisler.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=bp@alien8.de \
--cc=brauner@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=chengming.zhou@linux.dev \
--cc=christophe.leroy@csgroup.eu \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=hpa@zytor.com \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=kees@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-sgx@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=luto@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=muchun.song@linux.dev \
--cc=npache@redhat.com \
--cc=npiggin@gmail.com \
--cc=nvdimm@lists.linux.dev \
--cc=osalvador@suse.de \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=pfalcato@suse.de \
--cc=riel@surriel.com \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shakeel.butt@linux.dev \
--cc=sparclinux@vger.kernel.org \
--cc=surenb@google.com \
--cc=tglx@linutronix.de \
--cc=urezki@gmail.com \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=xu.xin16@zte.com.cn \
--cc=zhengqi.arch@bytedance.com \
--cc=ziy@nvidia.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;
as well as URLs for NNTP newsgroup(s).