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 2/2] ipc: get rid of free_ipc_work workqueue
Date: Fri, 18 Feb 2022 13:31:14 -0500 [thread overview]
Message-ID: <20220218183114.2867528-3-riel@surriel.com> (raw)
In-Reply-To: <20220218183114.2867528-1-riel@surriel.com>
With kern_unmount deferring the freeing of the vfsmount structure
through queue_rcu_work, we no longer need a separate workqueue for
freeing up ipc_namespace structures.
Signed-off-by: Rik van Riel <riel@surriel.com>
---
include/linux/ipc_namespace.h | 2 --
ipc/namespace.c | 21 +--------------------
2 files changed, 1 insertion(+), 22 deletions(-)
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index b75395ec8d52..5a3debde2f3d 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -67,8 +67,6 @@ struct ipc_namespace {
struct user_namespace *user_ns;
struct ucounts *ucounts;
- struct llist_node mnt_llist;
-
struct ns_common ns;
} __randomize_layout;
diff --git a/ipc/namespace.c b/ipc/namespace.c
index ae83f0f2651b..090a08b17710 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -117,9 +117,6 @@ void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
static void free_ipc_ns(struct ipc_namespace *ns)
{
- /* mq_put_mnt() waits for a grace period as kern_unmount()
- * uses synchronize_rcu().
- */
mq_put_mnt(ns);
sem_exit_ns(ns);
msg_exit_ns(ns);
@@ -131,21 +128,6 @@ static void free_ipc_ns(struct ipc_namespace *ns)
kfree(ns);
}
-static LLIST_HEAD(free_ipc_list);
-static void free_ipc(struct work_struct *unused)
-{
- struct llist_node *node = llist_del_all(&free_ipc_list);
- struct ipc_namespace *n, *t;
-
- llist_for_each_entry_safe(n, t, node, mnt_llist)
- free_ipc_ns(n);
-}
-
-/*
- * The work queue is used to avoid the cost of synchronize_rcu in kern_unmount.
- */
-static DECLARE_WORK(free_ipc_work, free_ipc);
-
/*
* put_ipc_ns - drop a reference to an ipc namespace.
* @ns: the namespace to put
@@ -168,8 +150,7 @@ void put_ipc_ns(struct ipc_namespace *ns)
mq_clear_sbinfo(ns);
spin_unlock(&mq_lock);
- if (llist_add(&ns->mnt_llist, &free_ipc_list))
- schedule_work(&free_ipc_work);
+ free_ipc_ns(ns);
}
}
--
2.34.1
prev parent 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 [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 ` Rik van Riel [this message]
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-3-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 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.