From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: "David Hildenbrand (Red Hat)" <david@kernel.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Kasireddy, Vivek" <vivek.kasireddy@intel.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>,
Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Subject: Re: [PATCH] mm/mremap: allow VMAs with VM_DONTEXPAND|VM_PFNMAP when creating new mapping
Date: Fri, 21 Nov 2025 10:03:18 -0500 [thread overview]
Message-ID: <cii5ukeq5uzktg6v6a5bnesjzenwkmnokdwvne333enekhtj4v@bs3jcbxafwt5> (raw)
In-Reply-To: <fc85d934-bd1b-4fbf-b4ab-37ba061e72b0@kernel.org>
* David Hildenbrand (Red Hat) <david@kernel.org> [251121 03:13]:
> >
> > Another way round here might be to try to use userland to figure out the file
> > that a mapping belongs to via e.g. /proc/$pid/map_files, determine the
> > attributes from /proc/$pid/maps and then generate a new mmap() call with the
> > same properties.
>
> Right, if we could find some way to just obtain the file/fd we could just
> avoid mremap altogether.
>
> I recall that CRIU used something similar to obtain the fd of a
> MAP_SHARED|MAP_ANON mapping (anon shmem) VMA, but my memory is a bit vague
> on that one.
There is an ioctl query method to get information on VMAs since 6.11.
Check Documentation/filesystems/proc.rst for this:
Starting with 6.11 kernel, /proc/PID/maps provides an alternative
ioctl()-based API that gives ability to flexibly and efficiently query and
filter individual VMAs. This interface is binary and is meant for more
efficient and easy programmatic use. `struct procmap_query`, defined in
linux/fs.h UAPI header, serves as an input/output argument to the
`PROCMAP_QUERY` ioctl() command. See comments in linus/fs.h UAPI header for
details on query semantics, supported flags, data returned, and general API
usage information.
... maybe that should be linux/fs.h and not linus/fs.h. The actual file
seems to be include/uapi/linux/fs.h (grepping for procmap_query).
Maybe you could make use of that ioctl to get what you want?
If not, maybe look at adding what you need there would be more of the
change you want to make?
Thanks,
Liam
next prev parent reply other threads:[~2025-11-21 15:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 5:35 Vivek Kasireddy
2025-11-20 9:04 ` Lorenzo Stoakes
2025-11-20 9:16 ` David Hildenbrand (Red Hat)
2025-11-20 9:35 ` Lorenzo Stoakes
2025-11-20 9:49 ` David Hildenbrand (Red Hat)
2025-11-20 9:58 ` Lorenzo Stoakes
2025-11-21 3:05 ` Akihiko Odaki
2025-11-21 8:03 ` Lorenzo Stoakes
2025-11-21 8:48 ` Akihiko Odaki
2025-11-21 9:10 ` Lorenzo Stoakes
2025-11-21 10:16 ` Akihiko Odaki
2025-11-21 10:52 ` Lorenzo Stoakes
2025-11-21 7:26 ` David Hildenbrand (Red Hat)
2025-11-21 6:51 ` Kasireddy, Vivek
2025-11-21 7:52 ` Lorenzo Stoakes
2025-11-21 8:13 ` David Hildenbrand (Red Hat)
2025-11-21 15:03 ` Liam R. Howlett [this message]
2025-11-22 6:56 ` Kasireddy, Vivek
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=cii5ukeq5uzktg6v6a5bnesjzenwkmnokdwvne333enekhtj4v@bs3jcbxafwt5 \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pfalcato@suse.de \
--cc=vbabka@suse.cz \
--cc=vivek.kasireddy@intel.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