diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2023-10-25 16:02:00 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-11-18 14:56:16 +0100 |
commit | 2eea9ce4310d8c0f8ef1dbe7b0e7d9219ff02b97 (patch) | |
tree | 6e1759ae01554e15a6d7b92d4a243f469deaa5b2 /fs/pnode.c | |
parent | 98d2b43081972abeb5bb5a087bc3e3197531c46e (diff) | |
download | linux-2eea9ce4310d8c0f8ef1dbe7b0e7d9219ff02b97.tar.gz linux-2eea9ce4310d8c0f8ef1dbe7b0e7d9219ff02b97.tar.bz2 linux-2eea9ce4310d8c0f8ef1dbe7b0e7d9219ff02b97.zip |
mounts: keep list of mounts in an rbtree
When adding a mount to a namespace insert it into an rbtree rooted in the
mnt_namespace instead of a linear list.
The mnt.mnt_list is still used to set up the mount tree and for
propagation, but not after the mount has been added to a namespace. Hence
mnt_list can live in union with rb_node. Use MNT_ONRB mount flag to
validate that the mount is on the correct list.
This allows removing the cursor used for reading /proc/$PID/mountinfo. The
mnt_id_unique of the next mount can be used as an index into the seq file.
Tested by inserting 100k bind mounts, unsharing the mount namespace, and
unmounting. No performance regressions have been observed.
For the last mount in the 100k list the statmount() call was more than 100x
faster due to the mount ID lookup not having to do a linear search. This
patch makes the overhead of mount ID lookup non-observable in this range.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Link: https://lore.kernel.org/r/20231025140205.3586473-3-mszeredi@redhat.com
Reviewed-by: Ian Kent <raven@themaw.net>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/pnode.c')
-rw-r--r-- | fs/pnode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/pnode.c b/fs/pnode.c index e4d0340393d5..a799e0315cc9 100644 --- a/fs/pnode.c +++ b/fs/pnode.c @@ -468,7 +468,7 @@ static void umount_one(struct mount *mnt, struct list_head *to_umount) mnt->mnt.mnt_flags |= MNT_UMOUNT; list_del_init(&mnt->mnt_child); list_del_init(&mnt->mnt_umounting); - list_move_tail(&mnt->mnt_list, to_umount); + move_from_ns(mnt, to_umount); } /* |