linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kasireddy, Vivek" <vivek.kasireddy@intel.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	"David Hildenbrand (Red Hat)" <david@kernel.org>,
	"lorenzo.stoakes@oracle.com" <lorenzo.stoakes@oracle.com>
Cc: "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: Sat, 22 Nov 2025 06:56:09 +0000	[thread overview]
Message-ID: <IA0PR11MB7185919CE5971661EB5C4519F8D2A@IA0PR11MB7185.namprd11.prod.outlook.com> (raw)
In-Reply-To: <cii5ukeq5uzktg6v6a5bnesjzenwkmnokdwvne333enekhtj4v@bs3jcbxafwt5>

> Subject: Re: [PATCH] mm/mremap: allow VMAs with
> VM_DONTEXPAND|VM_PFNMAP when creating new mapping
> 
> * 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?
Thank you Liam, Lorenzo, David for your suggestions and comments.
We'll try other ways to address our use-case including exploring the
idea of obtaining the underlying fd via VFIO APIs or using
/proc/PID/maps.

Thanks,
Vivek

> 
> Thanks,
> Liam


      reply	other threads:[~2025-11-22  6:56 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
2025-11-22  6:56           ` Kasireddy, Vivek [this message]

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=IA0PR11MB7185919CE5971661EB5C4519F8D2A@IA0PR11MB7185.namprd11.prod.outlook.com \
    --to=vivek.kasireddy@intel.com \
    --cc=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 \
    /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