Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp67419pxb; Mon, 13 Sep 2021 13:07:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDmny+PWjDTnDJMkwc66lIzZOc7M2wpxKKGqWaybJ5QKvol8KojqshaDNVEte7Y6doLTb/ X-Received: by 2002:aa7:cd92:: with SMTP id x18mr14939495edv.325.1631563675612; Mon, 13 Sep 2021 13:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631563675; cv=none; d=google.com; s=arc-20160816; b=ICOUjF0RT8FLH2Os3kOFI1V+YnSExtEjApd2sDymAgAlnRfkyU+ev+L3o3bGVcF5rx FVnkym0MVs71o9uMZCIboMPYJiWc05h8jxunydLJ6yECP3l8bxL6CFXTPF/wpUxu76ki rl3Ucs3XM6K+UkrvTQSqvmDpypjc4YHwlnqm6vA90/tE4r+WLz9qD23jM9n0z6g70Arj 6VmWAAz2vo3Jij3C9i3SJUITbRbjDQgDqSsB6myQQx8PncLB7rXWF4L7IS6Dqm9aibNx sVeBXiY3NAgSo61M8ikz3mW1Dydm0aduRLMJ8+EqYgBtU8wgU2EfyE6Lxx7Do1tQxLQ9 XMzA== 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=V6h7Z3K9OVT86R21RvzFrb6CxHQigfNIfR5AI9ME5Ak=; b=clP/3cdVga4t/LNVNPl+RQ3lwqN3pAJhFB1Wiv5reyGx5M/mlDgq5Mrb55zhsxvbkB lar24i5J7eDCM/Df7rhiLa+OuFq0sHWXnTYnRJAalVzL3Pb/lNtVuNw4SctgAR9zuhgx YloYIFog2P2fj3F3tL09DCXQLBNuFC4SuJ3yrmA4gFDKNnczeM8bCFIB8Vj9PTPZXS/W XC5MuxjCELt2l7kEr11XF7vEFAGe3WTWeN8Zxz/bL/HCqkk/cNfx0yhwnC1beQTL6Auo JOnAAK/OB2fjTrOq/8pwbODASVmc6J8RviBL6lovPVYTu1QgIy8BhEM1NmmmooBHSgZp PyVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sfpIxAaZ; 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 di7si8719230ejc.345.2021.09.13.13.07.29; Mon, 13 Sep 2021 13:07:55 -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=sfpIxAaZ; 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 S241586AbhIMNrj (ORCPT + 99 others); Mon, 13 Sep 2021 09:47:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:43048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243290AbhIMNmM (ORCPT ); Mon, 13 Sep 2021 09:42:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 16E876140D; Mon, 13 Sep 2021 13:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539814; bh=HadPXS1NZwfYjrBXJXfxjbPKQrCZynBQTKqPR9gvFNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sfpIxAaZ8Bz8X1EFzHRMdX4N8ZaqYZgxYRvOD0SR6bbWakKPdrowMWvNikhG7Kdtl uJKbjVFEhkcVY8o3V79iLa0SjllwqeCmXkDsVtI0sGAXSR2nFi/4QSX1epzi3cUBGy H2YzGD2hYmQ2RjxrsVlMF7AaPJzhrd0jHixO+8M0= 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.10 138/236] cgroup/cpuset: Miscellaneous code cleanup Date: Mon, 13 Sep 2021 15:14:03 +0200 Message-Id: <20210913131105.051434132@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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 e1601d8dac29..190355aae7ee 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