Linux filesystem development
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Tal Zussman <tz2294@columbia.edu>
Cc: "David Hildenbrand (Arm)" <david@kernel.org>,
	"Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Barry Song <baohua@kernel.org>, Dev Jain <dev.jain@arm.com>,
	Hugh Dickins <hughd@google.com>, Jann Horn <jannh@google.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	John Hubbard <jhubbard@nvidia.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Lance Yang <lance.yang@linux.dev>,
	"Liam R. Howlett" <liam@infradead.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Michal Hocko <mhocko@suse.com>,
	Muchun Song <muchun.song@linux.dev>,
	Nico Pache <nico.pache@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	Pedro Falcato <pfalcato@suse.de>, Peter Xu <peterx@redhat.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Usama Arif <usama.arif@linux.dev>,
	Vlastimil Babka <vbabka@kernel.org>, Zi Yan <ziy@nvidia.com>,
	linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] userfaultfd: collapse VM_UFFD_{MISSING,WP,MINOR,RWP} into single VM_UFFD
Date: Sun, 30 Aug 2026 08:36:01 +0300	[thread overview]
Message-ID: <apPBQQ-850DwlCVA@kernel.org> (raw)
In-Reply-To: <178802897277.671075.10362065249796431311.b4-reply@b4>

On Sat, Aug 29, 2026 at 02:42:52PM -0400, Tal Zussman wrote:
> On 2026-08-29 14:00 +0300, Mike Rapoport wrote:
> > On Thu, Aug 27, 2026 at 05:19:30PM +0200, David Hildenbrand (Arm) wrote:
> > > On 8/27/26 13:18, Lorenzo Stoakes (ARM) wrote:
> > > > On Thu, Aug 27, 2026 at 12:16:32PM +0100, Lorenzo Stoakes (ARM) wrote:
> > > >> So actually you're increasing by a cacheline and increasing the VMA size by
> > > >> 64 bytes, i.e. 1/3, which is unacceptable obviously.
> > > >>
> > > >> Maybe there's something that can be done with:
> > > >>
> > > >> 		/* forced alignments: 1 */
> > > >>
> > > >> Perhaps? But that looks potentially ugly.
> > > >>
> > > > 
> > > > I say elsewhere (or think I do) but to highlight - I think probably we could fix
> > > > this by putting the flags in the low bits of vm_uffd_state.ctx?
> > > 
> > > if that's possible that would be clearly preferable memory-wise.
> > 
> > This gives only 4 bits and makes this completely not extendable.
> 
> Wouldn't it be 6 bits? struct userfaultfd_ctx is allocated with
> kmem_cache_create() and SLAB_HWCACHE_ALIGN, and most of the flags are
> only available on 64 bit, so it should be 64-byte aligned in the
> relevant cases.
> 
> (Not that 6 is that much better than 4... but it's a little more wiggle
> room.)

I did remember that SLAB_HWCACHE_ALIGN could be as small as 16 bytes, but I
didn't verify it for architectures that support fancy uffd modes.
 
> It could in theory also be bumped up to 7 by setting align in
> kmem_cache_create(). userfaultfd_ctx already takes 192 bytes due to
> existing alignment. Aligning it to 128 bytes would make it 256 bytes,
> adding 64 bytes to each uffd rather than each VMA. But this sounds like
> more pain for little gain :)

Yeah, even with as plenty as 7 bits :)
 
> > So I think I'll drop this for now and wait until VMA grows another cache
> > line or until having per-VMA uffd state rather than a pointer to per-fd
> > context is a must.
> >  
> > > -- 
> > > Cheers,
> > > 
> > > David
> > 
> > -- 
> > Sincerely yours,
> > Mike.
> > 
> > 
> 
> 

-- 
Sincerely yours,
Mike.

      reply	other threads:[~2026-08-30  5:36 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 12:17 [PATCH 0/6] userfaultfd: decouple uffd mode from VMA flags Mike Rapoport (Microsoft)
2026-08-23 12:17 ` [PATCH 1/6] mm/gup: move gup_can_follow_protnone() to gup.c Mike Rapoport (Microsoft)
2026-08-23 21:03   ` Barry Song
2026-08-24 14:42   ` David Hildenbrand (Arm)
2026-08-25 10:10     ` Mike Rapoport
2026-08-24 14:59   ` Lorenzo Stoakes (ARM)
2026-08-25  2:03   ` Zi Yan
2026-08-23 12:17 ` [PATCH 2/6] userfaultfd: constify VMA parameter of userfaultfd_*() helpers Mike Rapoport (Microsoft)
2026-08-23 21:03   ` Barry Song
2026-08-24 15:03   ` Lorenzo Stoakes (ARM)
2026-08-25  2:03   ` Zi Yan
2026-08-23 12:17 ` [PATCH 3/6] userfaultfd: use userfaultfd_*() helpers instead of open coded flag tests Mike Rapoport (Microsoft)
2026-08-23 21:14   ` Barry Song
2026-08-24 15:10   ` Lorenzo Stoakes (ARM)
2026-08-25 11:19     ` Mike Rapoport
2026-08-25 11:26       ` Lorenzo Stoakes (ARM)
2026-08-27  7:14         ` Mike Rapoport
2026-08-23 12:17 ` [PATCH 4/6] userfaultfd: rename vm_userfaultfd_ctx to vm_uffd_state Mike Rapoport (Microsoft)
2026-08-24 14:43   ` David Hildenbrand (Arm)
2026-08-24 15:42   ` Lorenzo Stoakes (ARM)
2026-08-23 12:17 ` [PATCH 5/6] userfaultfd: decouple fault reason from VMA flags Mike Rapoport (Microsoft)
2026-08-24  8:12   ` Muchun Song
2026-08-24 14:46   ` David Hildenbrand (Arm)
2026-08-27  7:49     ` Mike Rapoport
2026-08-27  8:10       ` David Hildenbrand (Arm)
2026-08-27  9:09         ` Mike Rapoport
2026-08-27  9:19           ` David Hildenbrand (Arm)
2026-08-27  9:21             ` Lorenzo Stoakes (ARM)
2026-08-24 16:28   ` Lorenzo Stoakes (ARM)
2026-08-25 10:37     ` Mike Rapoport
2026-08-25 11:08       ` David Hildenbrand (Arm)
2026-08-25 11:38         ` Lorenzo Stoakes (ARM)
2026-08-25 13:00       ` Lorenzo Stoakes (ARM)
2026-08-27  7:42         ` Mike Rapoport
2026-08-27 11:29           ` Lorenzo Stoakes (ARM)
2026-08-23 12:17 ` [PATCH 6/6] userfaultfd: collapse VM_UFFD_{MISSING,WP,MINOR,RWP} into single VM_UFFD Mike Rapoport (Microsoft)
2026-08-24  7:11   ` Lance Yang
2026-08-24  8:17     ` Mike Rapoport
2026-08-24  8:27       ` Lance Yang
2026-08-25 12:44   ` Lorenzo Stoakes (ARM)
2026-08-25 12:45     ` Lorenzo Stoakes (ARM)
2026-08-27  9:03     ` Mike Rapoport
2026-08-27 11:16       ` Lorenzo Stoakes (ARM)
2026-08-27 11:18         ` Lorenzo Stoakes (ARM)
2026-08-27 15:19           ` David Hildenbrand (Arm)
2026-08-29 11:00             ` Mike Rapoport
2026-08-29 18:42               ` Tal Zussman
2026-08-30  5:36                 ` Mike Rapoport [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=apPBQQ-850DwlCVA@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hughd@google.com \
    --cc=jannh@google.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nico.pache@linux.dev \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=pfalcato@suse.de \
    --cc=rostedt@goodmis.org \
    --cc=ryan.roberts@arm.com \
    --cc=shakeel.butt@linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=tz2294@columbia.edu \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --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