Miklos Szeredi 2eea9ce431
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>
2023-11-18 14:56:16 +01:00
..
2023-11-04 09:20:04 -10:00
2023-11-07 12:11:26 -08:00
2023-11-01 15:28:33 -10:00
2023-10-30 09:47:13 -10:00
2023-11-07 12:11:26 -08:00
2023-11-10 09:52:56 -08:00
2023-10-30 09:47:13 -10:00
2023-11-03 15:15:47 -10:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-03 22:24:11 +09:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 11:54:17 -08:00
2023-10-30 09:47:13 -10:00
2023-10-30 09:47:13 -10:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-03 15:15:47 -10:00
2023-11-08 13:39:16 -08:00
2023-11-07 12:11:26 -08:00
2023-08-31 12:07:34 -05:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-10-30 09:47:13 -10:00
2023-11-07 12:11:26 -08:00
2023-10-30 19:26:39 -10:00
2023-10-30 09:47:13 -10:00
2023-11-11 17:17:22 -08:00
2023-11-07 12:11:26 -08:00
2023-11-03 07:41:18 -10:00
\n
2023-11-02 08:19:51 -10:00
2023-11-07 12:11:26 -08:00
2023-11-08 13:22:16 -08:00
2023-10-30 19:28:19 -10:00
2023-10-30 19:28:19 -10:00
2023-06-26 09:50:21 -07:00
2023-05-17 09:16:59 +02:00
2023-08-21 13:46:25 -07:00
2023-10-30 09:14:19 -10:00
2023-10-19 11:02:47 +02:00
2023-08-28 11:04:18 -07:00
2023-11-01 15:28:33 -10:00
2023-08-19 12:12:12 +02:00
2023-11-07 12:11:26 -08:00
2023-10-22 17:08:07 -04:00
2023-10-30 09:14:19 -10:00
2023-05-19 04:30:22 +02:00
2023-08-15 08:32:45 +02:00
2023-11-18 14:56:16 +01:00
2023-11-07 11:46:31 -08:00
2023-02-20 11:53:11 -08:00