All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fix rate limited ipc_namespace freeing
@ 2022-02-18 18:31 Rik van Riel
  2022-02-18 18:31 ` [PATCH 1/2] vfs: free vfsmount through rcu work from kern_unmount Rik van Riel
  2022-02-18 18:31 ` [PATCH 2/2] ipc: get rid of free_ipc_work workqueue Rik van Riel
  0 siblings, 2 replies; 12+ messages in thread
From: Rik van Riel @ 2022-02-18 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-team, linux-fsdevel, paulmck, gscrivan, viro, Rik van Riel

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(-)

-- 
2.34.1


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

end of thread, other threads:[~2022-02-19  6:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-18 18:31 [PATCH 0/2] fix rate limited ipc_namespace freeing Rik van Riel
2022-02-18 18:31 ` [PATCH 1/2] vfs: free vfsmount through rcu work from kern_unmount Rik van Riel
2022-02-18 19:26   ` Al Viro
2022-02-18 19:33     ` Rik van Riel
2022-02-18 19:43       ` Al Viro
2022-02-18 20:24         ` Al Viro
2022-02-18 21:06           ` Al Viro
2022-02-19  5:50             ` Al Viro
2022-02-19  5:53   ` Al Viro
2022-02-19  5:58     ` Al Viro
2022-02-19  6:07       ` Al Viro
2022-02-18 18:31 ` [PATCH 2/2] ipc: get rid of free_ipc_work workqueue Rik van Riel

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.