All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 0/3] vfs: Use an xarray instead of inserted bookmarks to scan mount list
@ 2021-03-15 12:07 David Howells
  2021-03-15 12:07 ` [PATCH 1/3] vfs: Use an xarray in the mount namespace to handle /proc/mounts list David Howells
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: David Howells @ 2021-03-15 12:07 UTC (permalink / raw)
  To: Alexander Viro, Miklos Szeredi
  Cc: Matthew Wilcox, dhowells, Matthew Wilcox, Ian Kent,
	Linus Torvalds, linux-fsdevel, linux-kernel


Hi Al, Miklós,

Can we consider replacing the "insert cursor" approach we're currently
using for proc files to scan the current namespace's mount list[1] with
something that uses an xarray of mounts indexed by mnt_id?

This has some advantages:

 (1) It's simpler.  We don't need to insert dummy mount objects as
     bookmarks into the mount list and code that's walking the list doesn't
     have to carefully step over them.

 (2) We can use the file position to represent the mnt_id and can jump to
     it directly - ie. using seek() to jump to a mount object by its ID.

 (3) It might make it easier to use RCU in future to dump mount entries
     rather than having to take namespace_sem.  xarray provides for the
     possibility of tagging entries to say that they're viewable to avoid
     dumping incomplete mount objects.

But there are a number of disadvantages:

 (1) We have to allocate memory to maintain the xarray, which becomes more
     of a problem as mnt_id values get scattered.

 (2) We need to preallocate the xarray memory because we're manipulating

 (3) The effect could be magnified because someone mounts an entire
     subtree and propagation has to copy all of it.

David

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9f6c61f96f2d97cbb5f7fa85607bc398f843ff0f [1]

---
David Howells (3):
      vfs: Use an xarray in the mount namespace to handle /proc/mounts list
      vfs: Use the mounts_to_id array to do /proc/mounts and co.
      vfs: Remove mount list trawling cursor stuff


 fs/mount.h            |  2 +-
 fs/namespace.c        | 66 ++++++++++---------------------------------
 fs/proc_namespace.c   |  3 --
 include/linux/mount.h |  4 +--
 4 files changed, 17 insertions(+), 58 deletions(-)



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

end of thread, other threads:[~2021-03-15 14:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 12:07 [RFC][PATCH 0/3] vfs: Use an xarray instead of inserted bookmarks to scan mount list David Howells
2021-03-15 12:07 ` [PATCH 1/3] vfs: Use an xarray in the mount namespace to handle /proc/mounts list David Howells
2021-03-15 12:07 ` [PATCH 2/3] vfs: Use the mounts_to_id array to do /proc/mounts and co David Howells
2021-03-15 12:54   ` Matthew Wilcox
2021-03-15 12:08 ` [PATCH 3/3] vfs: Remove mount list trawling cursor stuff David Howells
2021-03-15 12:46 ` [RFC][PATCH 0/3] vfs: Use an xarray instead of inserted bookmarks to scan mount list Matthew Wilcox
2021-03-15 13:14 ` Miklos Szeredi
2021-03-15 13:17   ` Matthew Wilcox
2021-03-15 13:41 ` David Howells
2021-03-15 14:22   ` Miklos Szeredi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.