All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: christian.brauner@ubuntu.com, akpm@linux-foundation.org,
	ebiederm@xmission.com, viro@zeniv.linux.org.uk,
	adobriyan@gmail.com, davem@davemloft.net,
	linux-kernel@vger.kernel.org, ktkhai@virtuozzo.com
Subject: [PATCH 7/8] cgroup: Use generic ns_common::count
Date: Mon, 03 Aug 2020 13:16:50 +0300	[thread overview]
Message-ID: <159644980994.604812.383801057081594972.stgit@localhost.localdomain> (raw)
In-Reply-To: <159644958332.604812.13004003379291842292.stgit@localhost.localdomain>

Convert cgroup namespace to use generic counter.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 include/linux/cgroup.h    |    5 ++---
 kernel/cgroup/cgroup.c    |    2 +-
 kernel/cgroup/namespace.c |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 618838c48313..451c2d26a5db 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -854,7 +854,6 @@ static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {}
 #endif	/* CONFIG_CGROUP_DATA */
 
 struct cgroup_namespace {
-	refcount_t		count;
 	struct ns_common	ns;
 	struct user_namespace	*user_ns;
 	struct ucounts		*ucounts;
@@ -889,12 +888,12 @@ copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
 static inline void get_cgroup_ns(struct cgroup_namespace *ns)
 {
 	if (ns)
-		refcount_inc(&ns->count);
+		refcount_inc(&ns->ns.count);
 }
 
 static inline void put_cgroup_ns(struct cgroup_namespace *ns)
 {
-	if (ns && refcount_dec_and_test(&ns->count))
+	if (ns && refcount_dec_and_test(&ns->ns.count))
 		free_cgroup_ns(ns);
 }
 
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index dd247747ec14..22e466926853 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -199,7 +199,7 @@ static u16 have_canfork_callback __read_mostly;
 
 /* cgroup namespace for init task */
 struct cgroup_namespace init_cgroup_ns = {
-	.count		= REFCOUNT_INIT(2),
+	.ns.count	= REFCOUNT_INIT(2),
 	.user_ns	= &init_user_ns,
 	.ns.ops		= &cgroupns_operations,
 	.ns.inum	= PROC_CGROUP_INIT_INO,
diff --git a/kernel/cgroup/namespace.c b/kernel/cgroup/namespace.c
index 812a61afd538..f5e8828c109c 100644
--- a/kernel/cgroup/namespace.c
+++ b/kernel/cgroup/namespace.c
@@ -32,7 +32,7 @@ static struct cgroup_namespace *alloc_cgroup_ns(void)
 		kfree(new_ns);
 		return ERR_PTR(ret);
 	}
-	refcount_set(&new_ns->count, 1);
+	refcount_set(&new_ns->ns.count, 1);
 	new_ns->ns.ops = &cgroupns_operations;
 	return new_ns;
 }



  parent reply	other threads:[~2020-08-03 10:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 10:16 [PATCH 0/8] namespaces: Introduce generic refcount Kirill Tkhai
2020-08-03 10:16 ` [PATCH 1/8] ns: Add common refcount into ns_common add use it as counter for net_ns Kirill Tkhai
2020-08-04 12:21   ` Eric W. Biederman
2020-08-04 12:48     ` Kirill Tkhai
2020-08-04 13:52       ` Eric W. Biederman
2020-08-04 14:36         ` Kirill Tkhai
2020-08-03 10:16 ` [PATCH 2/8] uts: Use generic ns_common::count Kirill Tkhai
2020-08-03 10:16 ` [PATCH 3/8] ipc: " Kirill Tkhai
2020-08-03 10:16 ` [PATCH 4/8] pid: " Kirill Tkhai
2020-08-03 10:16 ` [PATCH 5/8] user: " Kirill Tkhai
2020-08-03 10:16 ` [PATCH 6/8] mnt: " Kirill Tkhai
2020-08-03 10:16 ` Kirill Tkhai [this message]
2020-08-03 10:17 ` [PATCH 8/8] time: " Kirill Tkhai
2020-08-04 11:56 ` [PATCH 0/8] namespaces: Introduce generic refcount Christian Brauner
2020-08-04 12:11   ` Eric W. Biederman
2020-08-04 12:30     ` Christian Brauner
2020-08-04 13:21       ` Eric W. Biederman
2020-08-04 14:57         ` Christian Brauner
2020-08-04 21:38           ` Kees Cook

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=159644980994.604812.383801057081594972.stgit@localhost.localdomain \
    --to=ktkhai@virtuozzo.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian.brauner@ubuntu.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.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.