On Tue, 2024-12-10 at 21:57 +0100, Christian Brauner wrote: > Hey, > > Currently we take the read lock when looking for a mount namespace to > list mounts in. We can make this lockless at least for the simple search > case. I'm less certain about stuff like rb_prev() and rb_next() that we > use when listing mount namespaces via nsfs. > > Creating a new mount namespace is a rather rare event compared with > querying mounts in a foreign mount namespace. Once this is picked up by > e.g., systemd to list mounts in another mount in isolated services and > containers this will be used a lot so this seems worthwhile doing. > > Thanks! > Christian > > --- > Christian Brauner (5): > mount: remove inlude/nospec.h include > fs: add mount namespace to rbtree late > fs: lockless mntns rbtree lookup > selftests: remove unneeded include > samples: add test-list-all-mounts > > fs/mount.h | 5 +- > fs/namespace.c | 102 ++++++++++----- > samples/vfs/.gitignore | 1 + > samples/vfs/Makefile | 2 +- > samples/vfs/test-list-all-mounts.c | 235 ++++++++++++++++++++++++++++++++++ > tools/testing/selftests/pidfd/pidfd.h | 1 - > 6 files changed, 311 insertions(+), 35 deletions(-) > --- > base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37 > change-id: 20241207-work-mount-rbtree-lockless-7d4071b74f18 > This does seem like a good candidate for lockless access. Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>