From: Rik van Riel <riel@surriel.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-team@fb.com, linux-fsdevel@vger.kernel.org,
paulmck@kernel.org, gscrivan@redhat.com, viro@zeniv.linux.org.uk,
Rik van Riel <riel@surriel.com>
Subject: [PATCH 0/2] fix rate limited ipc_namespace freeing
Date: Fri, 18 Feb 2022 13:31:12 -0500 [thread overview]
Message-ID: <20220218183114.2867528-1-riel@surriel.com> (raw)
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
next reply other threads:[~2022-02-18 18:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 18:31 Rik van Riel [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220218183114.2867528-1-riel@surriel.com \
--to=riel@surriel.com \
--cc=gscrivan@redhat.com \
--cc=kernel-team@fb.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).