linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] fs,mm: add kmem_cache_create_rcu()
@ 2024-08-27 15:59 Christian Brauner
  2024-08-27 15:59 ` [PATCH v2 1/3] mm: remove unused root_cache argument Christian Brauner
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Christian Brauner @ 2024-08-27 15:59 UTC (permalink / raw)
  To: Vlastimil Babka, Jens Axboe, Paul E. McKenney, Roman Gushchin,
	Jann Horn, Linus Torvalds, linux-mm
  Cc: Christian Brauner, linux-fsdevel

When a kmem cache is created with SLAB_TYPESAFE_BY_RCU the free pointer
must be located outside of the object because we don't know what part of
the memory can safely be overwritten as it may be needed to prevent
object recycling.

That has the consequence that SLAB_TYPESAFE_BY_RCU may end up adding a
new cacheline. This is the case for .e.g, struct file. After having it
shrunk down by 40 bytes and having it fit in three cachelines we still
have SLAB_TYPESAFE_BY_RCU adding a fourth cacheline because it needs to
accomodate the free pointer and is hardware cacheline aligned.

I tried to find ways to rectify this as struct file is pretty much
everywhere and having it use less memory is a good thing. So here's a
proposal.

I was hoping to get something to this effect into v6.12.

If we really want to switch to a struct to pass kmem_cache parameters I
can do the preparatory patch to convert all kmem_cache_create() and
kmem_cache_create_usercopy() callers to use a struct for initialization
of course. I can do this as a preparatory work or as follow-up work to
this series. Thoughts?

Thanks!
Christian

---
---
base-commit: 766508e7e2c5075eb744cb29b8cef6fa835b0344
change-id: 20240827-work-kmem_cache-rcu-f97e35600cc6


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-08-28 15:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 15:59 [PATCH v2 0/3] fs,mm: add kmem_cache_create_rcu() Christian Brauner
2024-08-27 15:59 ` [PATCH v2 1/3] mm: remove unused root_cache argument Christian Brauner
2024-08-27 15:59 ` [PATCH v2 2/3] mm: add kmem_cache_create_rcu() Christian Brauner
2024-08-27 18:33   ` Linus Torvalds
2024-08-27 21:10   ` Vlastimil Babka
2024-08-28  9:47     ` Christian Brauner
2024-08-27 15:59 ` [PATCH v2 3/3] fs: use kmem_cache_create_rcu() Christian Brauner
2024-08-27 16:05 ` [PATCH v2 0/3] fs,mm: add kmem_cache_create_rcu() Christian Brauner
2024-08-27 20:15   ` Vlastimil Babka
2024-08-28 12:18     ` Christian Brauner
2024-08-28 15:32       ` Vlastimil Babka

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).