Message ID | 20221220151415.856093-1-neelx@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3024429wrn; Tue, 20 Dec 2022 07:22:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ir0fRIbPg3XS60ruiPtQCgZUXu0szV2DeXllZRhsFFVQPIgswl5LRZVF/fDzeeLMxAaJK X-Received: by 2002:aa7:c40c:0:b0:46c:a1f7:d9c5 with SMTP id j12-20020aa7c40c000000b0046ca1f7d9c5mr39916871edq.38.1671549748361; Tue, 20 Dec 2022 07:22:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671549748; cv=none; d=google.com; s=arc-20160816; b=iBnJc937I1ItsEAJawAxqjMTH7h322RLmbuEYOjYj5dD1fYjJ+nxwW+G77ufd0XT/9 yU9Ngin6MwSQtDPDrr8kcHtBw0vyoxG0MOYRN1dfGIuDwxM3mMHX9MFYVCizcUfgstRo /3p6eYcDtkWrJWT5zsvaX9OVdDlkDKlp0hjzNRwRHC354uzpIJMm0Wi0XuGCUTWcbniV GGux2HyZSPwOTWM7lSkmFkmq+nbyJ4Pit/xfgDAIrPyddZXPr169AeYmGY2FO1UBKzia n0eoeuxB6nz0Cvrq1IcPFGi81clW1/cgbfFjTMdq/ykSngs+C9GiLQsY7/A6NIbUmOuO 9W1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bMwcEP88aaxPcKpXm4Jr7ZoA7j+pIF0TnJwOHWp6n0E=; b=b5vp4qj4wh6HqT2ueiVFGMm4Uuw3Bgb+r5dd0mdav6x6g5WXYTd0HvIsOwWvuCWUQ5 Be1QKkmD5WJt7guyOC/iyjLh46puWGPSbqJnlsadJHyS5GWXW8Z9h/7tp8eiU/OYp0EP 17yufR0MiYkntG+vLRqR0rDwBiGzEjDUbJMMzHkpH6Z1sE3DaIipvtwTaghpJ2ndpeF/ Pdfjv1dvA8gLnwuy9DdDcvo0DkO92YyDOgKG6dFXhBhLrSqmRkb2LC5gME0X9VW6geV8 zKdmsE3C007ce4ShQrYx0Wzi25hGID5MnDGP2lMuEBXy32mGGCWoWXdV9h8SS8TgJKFc 8vFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eQNZVP7x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vg11-20020a170907d30b00b0078d85777c4fsi10835287ejc.700.2022.12.20.07.21.45; Tue, 20 Dec 2022 07:22:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eQNZVP7x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233364AbiLTPPD (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Tue, 20 Dec 2022 10:15:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiLTPPA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 20 Dec 2022 10:15:00 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23599B4AC for <linux-kernel@vger.kernel.org>; Tue, 20 Dec 2022 07:14:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671549265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bMwcEP88aaxPcKpXm4Jr7ZoA7j+pIF0TnJwOHWp6n0E=; b=eQNZVP7xmLmiQ/e6P+T5VsSm/WW8/GXyV3vHld0WvAuiOWx+IlWaMJkwWDET8wvpYYleAT 90m8R67uHo8uhHUXGD7RvRZxXX2cdMln98TtES2fc/3291tNQqSbwiluaMne99ObUDi0kV JSU4ETvtQNLsjylbqFsFpRVjh8F+tDk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-uA6-OmjONnKk2VNk8fsJgQ-1; Tue, 20 Dec 2022 10:14:21 -0500 X-MC-Unique: uA6-OmjONnKk2VNk8fsJgQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C8AE2802E3A; Tue, 20 Dec 2022 15:14:21 +0000 (UTC) Received: from metal.redhat.com (ovpn-194-53.brq.redhat.com [10.40.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DC2D2026D4B; Tue, 20 Dec 2022 15:14:19 +0000 (UTC) From: Daniel Vacek <neelx@redhat.com> To: Waiman Long <longman@redhat.com>, Zefan Li <lizefan.x@bytedance.com>, Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org> Cc: Daniel Vacek <neelx@redhat.com>, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cgroup/cpuset: no need to explicitly init a global static variable Date: Tue, 20 Dec 2022 16:14:15 +0100 Message-Id: <20221220151415.856093-1-neelx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752746949079093414?= X-GMAIL-MSGID: =?utf-8?q?1752746949079093414?= |
Series |
cgroup/cpuset: no need to explicitly init a global static variable
|
|
Commit Message
Daniel Vacek
Dec. 20, 2022, 3:14 p.m. UTC
cpuset_rwsem is a static variable. It's initialized at build time and so
there's no need for explicit runtime init leaking one percpu int.
Signed-off-by: Daniel Vacek <neelx@redhat.com>
---
kernel/cgroup/cpuset.c | 2 --
1 file changed, 2 deletions(-)
Comments
On 12/20/22 10:14, Daniel Vacek wrote: > cpuset_rwsem is a static variable. It's initialized at build time and so > there's no need for explicit runtime init leaking one percpu int. > > Signed-off-by: Daniel Vacek <neelx@redhat.com> > --- > kernel/cgroup/cpuset.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index a29c0b13706bb..87fe410361b3d 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = { > > int __init cpuset_init(void) > { > - BUG_ON(percpu_init_rwsem(&cpuset_rwsem)); > - > BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL)); > BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL)); > BUG_ON(!zalloc_cpumask_var(&top_cpuset.subparts_cpus, GFP_KERNEL)); It will be clearer if you mention that DEFINE_STATIC_PERCPU_RWSEM() is used to set up cpuset_rwsem at build time. Other than that, the patch looks good to me. Cheers, Longman
On Tue 2022-12-20 16:14 +0100, Daniel Vacek wrote: > cpuset_rwsem is a static variable. It's initialized at build time and so > there's no need for explicit runtime init leaking one percpu int. > > Signed-off-by: Daniel Vacek <neelx@redhat.com> > --- > kernel/cgroup/cpuset.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index a29c0b13706bb..87fe410361b3d 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = { > > int __init cpuset_init(void) > { > - BUG_ON(percpu_init_rwsem(&cpuset_rwsem)); > - > BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL)); > BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL)); > BUG_ON(!zalloc_cpumask_var(&top_cpuset.subparts_cpus, GFP_KERNEL)); > -- > 2.38.1 Good catch. Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
Hi, On 12/20/2022 8:44 PM, Daniel Vacek wrote: > cpuset_rwsem is a static variable. It's initialized at build time and so > there's no need for explicit runtime init leaking one percpu int. > > Signed-off-by: Daniel Vacek <neelx@redhat.com> > --- > kernel/cgroup/cpuset.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index a29c0b13706bb..87fe410361b3d 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = { > > int __init cpuset_init(void) > { > - BUG_ON(percpu_init_rwsem(&cpuset_rwsem)); > - > BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL)); > BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL)); > BUG_ON(!zalloc_cpumask_var(&top_cpuset.subparts_cpus, GFP_KERNEL)); Acked-by: Mukesh Ojha <quic_mojha@quicinc.com> -Mukesh
On Tue, Dec 20, 2022 at 5:59 PM Waiman Long <longman@redhat.com> wrote: > > On 12/20/22 10:14, Daniel Vacek wrote: > > cpuset_rwsem is a static variable. It's initialized at build time and so > > there's no need for explicit runtime init leaking one percpu int. > > It will be clearer if you mention that DEFINE_STATIC_PERCPU_RWSEM() is > used to set up cpuset_rwsem at build time. Other than that, the patch > looks good to me. That's true. I only figured later. Whoever is going to apply it, feel free to amend the message if you like. --nX > Cheers, > Longman >
On Tue, Dec 20, 2022 at 04:14:15PM +0100, Daniel Vacek wrote: > cpuset_rwsem is a static variable. It's initialized at build time and so > there's no need for explicit runtime init leaking one percpu int. > > Signed-off-by: Daniel Vacek <neelx@redhat.com> Applied to cgroup/for-6.2-fixes with the following description: cgroup/cpuset: no need to explicitly init a global static variable cpuset_rwsem is a static variable defined with DEFINE_STATIC_PERCPU_RWSEM(). It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int. Signed-off-by: Daniel Vacek <neelx@redhat.com> Reviewed-by: Aaron Tomlin <atomlin@atomlin.com> Acked-by: Mukesh Ojha <quic_mojha@quicinc.com> Signed-off-by: Tejun Heo <tj@kernel.org> Thanks.
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index a29c0b13706bb..87fe410361b3d 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = { int __init cpuset_init(void) { - BUG_ON(percpu_init_rwsem(&cpuset_rwsem)); - BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL)); BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL)); BUG_ON(!zalloc_cpumask_var(&top_cpuset.subparts_cpus, GFP_KERNEL));