On Thu, Jul 30, 2020 at 02:59:57PM +0300, Kirill Tkhai wrote: > Convert cgroup namespace to use generic counter. > > Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> > ---
Looks good! Acked-by: Christian Brauner <christian.brau...@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; > } > >