Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp168286pxb; Mon, 13 Sep 2021 16:06:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwChBhjdSI9nrJgBfa9pPaeM9a14/nsF3pT9+N1cSSgfp/y3mzniita9d2+Gm3YA6yyPWvx X-Received: by 2002:a17:907:9723:: with SMTP id jg35mr15032743ejc.187.1631574412931; Mon, 13 Sep 2021 16:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631574412; cv=none; d=google.com; s=arc-20160816; b=WrTsPv+b+xuHRa5Xnq2Zq6SHsZk0yrXLhoxWW6iUELWesYubg1Wr88YvbpkczWZ7PX OrPDmYsMS9apymAiNIuzw7U8A6yO6nVXc5/mTrJd6reM9Y0queL7CetaFBapjPcGqUKg /EaaRVEsRt+inMj2ryCcRzzILahNRpIyv8c0nRaLjLietNYOWqltMgaHtRKuLwVAd2d5 TkkyMzUgB9sYbdnH7a2jSjNgSvE68AkFfNMhxiY3a3fpj9zpi9/8R18g+7uQfWD4Qcoh WLVVpC7zEmwBgzkDxHF/dEuigkz1sgCe/Ty1/IOg79e3zuts3/XTjMS3nCsWG9cy/aRH Xzsg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X4uvf+0G3mWVHTKpno7EakMwSS9T8w295D/FJ87mKUk=; b=S8BwJK+ilCAnu7OhUqtkJx/f8xT4KUzeUZcFF50NVZ7LryTHDrUrskFckjo3L1ViNZ PrbcXngJI7aPyRQVTeKQb/q4zjnWShPvQer3hFgN//RAcm1/1bBgh2UJlWz1bv8gLWRR nzMqk9WhIgbn+YUherEzQWHjl/yOIlRIftCZlak0b4LPvPcmS3J3kU+qItFmh6r4xPQY cCn2xJeNTH2AFft28SJvP7D+fhzmY7umoaqTdkyY7PyucjqbNWJNNW2XS5JRAjMrxh+j GomSh+3zF0cafkANPredTKhyHSoUwayqzQkzF+p7+hNA7ZVR9t6orD4oP0EbRzoqWyN6 U7RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kVRGNbpU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si8670065ede.550.2021.09.13.16.06.29; Mon, 13 Sep 2021 16:06:52 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kVRGNbpU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346652AbhIMOj0 (ORCPT + 99 others); Mon, 13 Sep 2021 10:39:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:53788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344469AbhIMOdw (ORCPT ); Mon, 13 Sep 2021 10:33:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 07E8361872; Mon, 13 Sep 2021 13:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631541167; bh=50zYpnkjEY2pTp+vMAnZUQeG2tdydDrCG/kJxt09Po8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVRGNbpUSquWDqfFrjXlzf07zuA7T+GbOqlnkJbAfXso/GQGSFomUPjT9m+nKjKFM kFpyR1VXs0yE5qvQEwPswU7Gv/KIL24PZmNLIJOVDCFZGVgVMAz0GXAa33S9XX1HiZ 7vxvKX/0cWXM/3rcUrF6NuV58n6GvhUSq9PCr6p4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Tejun Heo , Sasha Levin Subject: [PATCH 5.14 190/334] cgroup/cpuset: Miscellaneous code cleanup Date: Mon, 13 Sep 2021 15:14:04 +0200 Message-Id: <20210913131119.783011997@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131113.390368911@linuxfoundation.org> References: <20210913131113.390368911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Waiman Long [ Upstream commit 0f3adb8a1e5f36e792598c1d77a2cfac9c90a4f9 ] Use more descriptive variable names for update_prstate(), remove unnecessary code and fix some typos. There is no functional change. Signed-off-by: Waiman Long Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cpuset.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 592e9e37542f..28a784bf64b1 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1114,7 +1114,7 @@ enum subparts_cmd { * cpus_allowed can be granted or an error code will be returned. * * For partcmd_disable, the cpuset is being transofrmed from a partition - * root back to a non-partition root. any CPUs in cpus_allowed that are in + * root back to a non-partition root. Any CPUs in cpus_allowed that are in * parent's subparts_cpus will be taken away from that cpumask and put back * into parent's effective_cpus. 0 should always be returned. * @@ -1225,7 +1225,7 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, /* * partcmd_update w/o newmask: * - * addmask = cpus_allowed & parent->effectiveb_cpus + * addmask = cpus_allowed & parent->effective_cpus * * Note that parent's subparts_cpus may have been * pre-shrunk in case there is a change in the cpu list. @@ -1365,12 +1365,12 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp) case PRS_DISABLED: /* * If parent is not a partition root or an - * invalid partition root, clear the state - * state and the CS_CPU_EXCLUSIVE flag. + * invalid partition root, clear its state + * and its CS_CPU_EXCLUSIVE flag. */ WARN_ON_ONCE(cp->partition_root_state != PRS_ERROR); - cp->partition_root_state = 0; + cp->partition_root_state = PRS_DISABLED; /* * clear_bit() is an atomic operation and @@ -1937,30 +1937,28 @@ out: /* * update_prstate - update partititon_root_state - * cs: the cpuset to update - * val: 0 - disabled, 1 - enabled + * cs: the cpuset to update + * new_prs: new partition root state * * Call with cpuset_mutex held. */ -static int update_prstate(struct cpuset *cs, int val) +static int update_prstate(struct cpuset *cs, int new_prs) { int err; struct cpuset *parent = parent_cs(cs); - struct tmpmasks tmp; + struct tmpmasks tmpmask; - if ((val != 0) && (val != 1)) - return -EINVAL; - if (val == cs->partition_root_state) + if (new_prs == cs->partition_root_state) return 0; /* * Cannot force a partial or invalid partition root to a full * partition root. */ - if (val && cs->partition_root_state) + if (new_prs && (cs->partition_root_state < 0)) return -EINVAL; - if (alloc_cpumasks(NULL, &tmp)) + if (alloc_cpumasks(NULL, &tmpmask)) return -ENOMEM; err = -EINVAL; @@ -1978,7 +1976,7 @@ static int update_prstate(struct cpuset *cs, int val) goto out; err = update_parent_subparts_cpumask(cs, partcmd_enable, - NULL, &tmp); + NULL, &tmpmask); if (err) { update_flag(CS_CPU_EXCLUSIVE, cs, 0); goto out; @@ -1990,18 +1988,18 @@ static int update_prstate(struct cpuset *cs, int val) * CS_CPU_EXCLUSIVE bit. */ if (cs->partition_root_state == PRS_ERROR) { - cs->partition_root_state = 0; + cs->partition_root_state = PRS_DISABLED; update_flag(CS_CPU_EXCLUSIVE, cs, 0); err = 0; goto out; } err = update_parent_subparts_cpumask(cs, partcmd_disable, - NULL, &tmp); + NULL, &tmpmask); if (err) goto out; - cs->partition_root_state = 0; + cs->partition_root_state = PRS_DISABLED; /* Turning off CS_CPU_EXCLUSIVE will not return error */ update_flag(CS_CPU_EXCLUSIVE, cs, 0); @@ -2015,11 +2013,11 @@ static int update_prstate(struct cpuset *cs, int val) update_tasks_cpumask(parent); if (parent->child_ecpus_count) - update_sibling_cpumasks(parent, cs, &tmp); + update_sibling_cpumasks(parent, cs, &tmpmask); rebuild_sched_domains_locked(); out: - free_cpumasks(NULL, &tmp); + free_cpumasks(NULL, &tmpmask); return err; } @@ -3060,7 +3058,7 @@ retry: goto retry; } - parent = parent_cs(cs); + parent = parent_cs(cs); compute_effective_cpumask(&new_cpus, cs, parent); nodes_and(new_mems, cs->mems_allowed, parent->effective_mems); -- 2.30.2