Skip to content

fix rate limited ipc_namespace freeing

Rik van Riel linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2vfs: free vfsmount through rcu work from kern_unmountfs/namespace.c include/linux/mount.h+11 -29 replies
2/2ipc: get rid of free_ipc_work workqueueinclude/linux/ipc_namespace.h ipc/namespace.c+1 -220 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] fix rate limited ipc_namespace freeing

The test case below fails on 5.17 (and a bunch of older kernels) with unshare getting -ENOSPC, because the rate at which ipc_namespace structures can be freed is limited by each item on the to-free list waiting in synchronize_rcu.

Making kern_unmount use queue_rcu_work gets rid of that slowdown, allowing a batch of vfsmount structures to be freed after each RCU grace period has expired.

That, in turn, allows us to just get rid of the workqueue in ipc/namespace.c completely.

With these two changes the test case reliably succeeds at calling unshare a million times, even with max_ipc_namespaces reduced to 1000 :)

#define _GNU_SOURCE
#include <sched.h>
#include <error.h>
#include <errno.h>
#include <stdlib.h>

int main()

{
	int i;

	for (i = 0; i < 1000000; i++) {
		if (unshare(CLONE_NEWIPC) < 0)
			error(EXIT_FAILURE, errno, "unshare");
	}
}

Rik van Riel (2):
vfs: free vfsmount through rcu work from kern_unmount
ipc: get rid of free_ipc_work workqueue

 fs/namespace.c                | 11 +++++++++--
 include/linux/ipc_namespace.h |  2 --
 include/linux/mount.h         |  2 ++
 ipc/namespace.c               | 21 +--------------------
 4 files changed, 12 insertions(+), 24 deletions(-)
Signature · 1 line
2.34.1