From: Al Viro <viro@zeniv.linux.org.uk>
To: Rik van Riel <riel@surriel.com>
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
linux-fsdevel@vger.kernel.org, gscrivan@redhat.com,
Chris Mason <clm@meta.com>
Subject: Re: [PATCH 2/2] ipc,namespace: batch free ipc_namespace structures
Date: Thu, 26 Jan 2023 21:14:16 +0000 [thread overview]
Message-ID: <Y9LtKMC8/qqLNgcZ@ZenIV> (raw)
In-Reply-To: <20230126205721.582612-3-riel@surriel.com>
On Thu, Jan 26, 2023 at 03:57:21PM -0500, Rik van Riel wrote:
> Instead of waiting for an RCU grace period between each ipc_namespace
> structure that is being freed, wait an RCU grace period for every batch
> of ipc_namespace structures.
>
> Thanks to Al Viro for the suggestion of the helper function.
>
> This speeds up the run time of the test case that allocates ipc_namespaces
> in a loop from 6 minutes, to a little over 1 second:
>
> real 0m1.192s
> user 0m0.038s
> sys 0m1.152s
>
> Signed-off-by: Rik van Riel <riel@surriel.com>
> Reported-by: Chris Mason <clm@meta.com>
> Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
OK, except that I'd rather
a) made it
if (mnt)
real_mount(mnt)->mnt_ns = NULL;
so that it would treat NULL as no-op and
b) made kern_unmount() and kern_unmount_array() use it:
void kern_unmount(struct vfsmount *mnt)
{
/* release long term mount so mount point can be released */
if (!IS_ERR(mnt)) {
mnt_make_shorterm(mnt);
synchronize_rcu(); /* yecchhh... */
mntput(mnt);
}
}
void kern_unmount_array(struct vfsmount *mnt[], unsigned int num)
{
unsigned int i;
for (i = 0; i < num; i++)
mnt_make_shorterm(mnt[i]);
synchronize_rcu_expedited();
for (i = 0; i < num; i++)
mntput(mnt[i]);
}
next prev parent reply other threads:[~2023-01-26 21:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 20:57 [PATCH 0/2] ipc,namespace: fix free vs allocation race Rik van Riel
2023-01-26 20:57 ` [PATCH 1/2] ipc,namespace: make ipc namespace allocation wait for pending free Rik van Riel
2023-01-26 20:57 ` [PATCH 2/2] ipc,namespace: batch free ipc_namespace structures Rik van Riel
2023-01-26 21:14 ` Al Viro [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-01-27 1:15 [PATCH v2 0/2] ipc,namespace: fix free vs allocation race Rik van Riel
2023-01-27 1:15 ` [PATCH 2/2] ipc,namespace: batch free ipc_namespace structures Rik van Riel
2023-01-27 11:03 ` Giuseppe Scrivano
2023-01-27 18:16 ` Rik van Riel
2023-01-27 18:46 [PATCH v3 0/2] ipc,namespace: fix free vs allocation race Rik van Riel
2023-01-27 18:46 ` [PATCH 2/2] ipc,namespace: batch free ipc_namespace structures 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=Y9LtKMC8/qqLNgcZ@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=clm@meta.com \
--cc=gscrivan@redhat.com \
--cc=kernel-team@meta.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=riel@surriel.com \
/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 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.