Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1942779pxa; Mon, 3 Aug 2020 03:20:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmtRF1lZSd+xYc8VCtmzXpgKbA4e7sVoh6Obl7Mxg6OR1IQ/O0iSxaULHDBZW9Ykg3r2wM X-Received: by 2002:a17:906:288d:: with SMTP id o13mr15074521ejd.199.1596450037961; Mon, 03 Aug 2020 03:20:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596450037; cv=none; d=google.com; s=arc-20160816; b=P5l+51XCnEofdBl4/4rO5Bsqy24M8EaN4zn+zJspaF/mswGnOREC0C/3s26WwOHseZ Se892pR6dQCdbUMJTBwvurtS4ZV8CCo2qvBtJGRzmfE7szUblrWed3b1LXRZwtdgwBZK qaDSOrGg0gUkmmRrYpfskP29Cs8v78mrZi0grva0BLY1p+rgFQMTe/Mb0GMf0tfGbRUD tTdbF2Xl1hK/SFeDwSpWbVJb49/Zam9901fVWSHCfgC5zlguZlF08y8Zt2Tx9fv2D2yN Tlot1AjIfDT+Ev8TvgLsID/G+t+5pEx1kLnR1YzNEpTwsbdJsWhI1aU5klg8HW+ky2KF OTfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=Mu+CUntRf+Q/VxPftAliGE/3Phgg8wpmNJ4dCPx2WXU=; b=X6PRAU8cGHF8vOSzktDObfq/Z0LAXJwd4otHoWINF3xj00tYHhNTTZMt9cBP3xazda nb4RkIaIG91WaYYFAZylsW2nW2K6IXAlUEq9APodwFcy5bovQr6rCgX66lWLVEnz81v9 c3n5uth/PxUA6okqc1Ze9qZNGo4U162OUezpHUYqfgiBllCjASeuGnULgutwRFt3BVFl r5Zcf3z9dO4MqbeVBduzChUpkSSfAaYEZEIG0zZA/22WBLgbr/6hvhf8lP26NN4VtZwR f8qhElYlBVdWAOA7ZYxswWTrIHuqXVTxkN/M+GZmcglVnkRLhtlgU0E8dHGKvY7vuz9n x+ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb13si10478312edb.336.2020.08.03.03.20.15; Mon, 03 Aug 2020 03:20:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726729AbgHCKQ6 (ORCPT + 99 others); Mon, 3 Aug 2020 06:16:58 -0400 Received: from relay.sw.ru ([185.231.240.75]:37954 "EHLO relay3.sw.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725951AbgHCKQ5 (ORCPT ); Mon, 3 Aug 2020 06:16:57 -0400 Received: from [192.168.15.50] (helo=localhost.localdomain) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from ) id 1k2XWE-0002OV-It; Mon, 03 Aug 2020 13:16:34 +0300 Subject: [PATCH 7/8] cgroup: Use generic ns_common::count From: Kirill Tkhai 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 Date: Mon, 03 Aug 2020 13:16:50 +0300 Message-ID: <159644980994.604812.383801057081594972.stgit@localhost.localdomain> In-Reply-To: <159644958332.604812.13004003379291842292.stgit@localhost.localdomain> References: <159644958332.604812.13004003379291842292.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert cgroup namespace to use generic counter. Signed-off-by: Kirill Tkhai Acked-by: Christian Brauner --- 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; }