Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2380022rdd; Fri, 12 Jan 2024 07:47:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbCTcoeqBBBXM1w918Af6+YQYosnMwMkqDLCTxiq3Ir74CFRWPKpkQro1fznkLTepxTXii X-Received: by 2002:a17:902:c10c:b0:1d4:638f:3ffa with SMTP id 12-20020a170902c10c00b001d4638f3ffamr1046566pli.49.1705074438697; Fri, 12 Jan 2024 07:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705074438; cv=none; d=google.com; s=arc-20160816; b=UirDznrUrK3CoH2zZ4Bft1Tfg1Ru+ookz6gAtsu6dXbEH4S62th+yk+9oNhpR606MR CQ6N/I2JsGX8rNg3kMv/2i3m9S8o5hJ1Sp9UPwj7IbJFSlCX+/k5ku5Y+cBedm9hDbTG ZsxmcTX9n8rGtQhlIbl2lAFV+OfDHPyzkKEIQ12D2c+YHgWAlL2z6e7yvK9k/nYnXYfV B3GQUukPAO8MRte5h77QS6aa1X6oDOMXHU42pUGwbHk5qc6UrQcEwxZbvbatATOz2cY2 pJJRVQNFs8hYZvc3CKVuBLhKfiAyDdY6VDX3sS8pc8r10XpjGsE0lw7/sgQPpoEuOZsU G7pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0zPSt/OGcYSWkUsPlJVc5ity/s/V7nu4SJkt0+pWrsU=; fh=LxXsyjFlXk8IKpomJhOEuAfMOggTFJag//5BxskdOPA=; b=wX30/s883pvIu39fn0qJe7cdGNiBfrnqlGzTCxZyk5e7OEuQDmSVlL4gzAop3NUVu5 0ScJnTLv3vtuXMNFy9tdnGgezyhFjOiu6pgjQ1R8iRh0IoHtkpC8aet5Hi20CIy73sp/ yuJD1qpXZ3Sk8CFEgV40AhHRfHHKLdtl1V1bazxu8gX542Q2D3aGpLIolOI59QMzec3C fZ71/zdTK/i1eb+hkYjd+k3/CLWEt158quRG+2mDORVReh4AZ7Z7lrvnyrEpKgRlSJuw oxi+DkfGGI/CY52MaLZ7fT9TWSM9FbohePIifAvS0uVVVRL2NoWXDu42IpeCyDUbyOSZ e1Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uS5uBpu4; spf=pass (google.com: domain of linux-kernel+bounces-24821-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k17-20020a170902f29100b001d352ecfa69si3300358plc.218.2024.01.12.07.47.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 07:47:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24821-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uS5uBpu4; spf=pass (google.com: domain of linux-kernel+bounces-24821-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C83A2830EE for ; Fri, 12 Jan 2024 15:47:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C83A7745D1; Fri, 12 Jan 2024 15:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uS5uBpu4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 089C57319F; Fri, 12 Jan 2024 15:46:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADB5FC433B1; Fri, 12 Jan 2024 15:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705074398; bh=/cQxWnqvZS3pZ1bKPTWJvWEqbyrOWscjBjQf2J79KU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uS5uBpu4kmfDvBa6MjrP2/TzKSp5FYWW9aaF9yP9XYVFRx/Nk8Ha0xuiBe2SY+EJX h/Q3e+WveP34vV+jJ1/sZLgVmR+Seez65KaL1eyTtt5ocdYzk6NRzSKm2eOo4h0I18 AgJ+iR0rMeJfLB3om+1zMJe2fIQKmUchD7AKm623NtIb3GgLXwR6ElPrqH5dZTulrI wqftYvX92Qlasa0lmfgLGibORq3bpTvZnK35ILr9XBb30e4jyMecA7mjIM5/ZPJXo1 TsQdm53r0YNHKy/LA9rCOnPR4LZ7v7pIBw274xP/kVqssVLp7/b6X/PUkr+ewoqOsh 9gZ47S9YFKGLg== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Boqun Feng , Joel Fernandes , Neeraj Upadhyay , "Paul E . McKenney" , Uladzislau Rezki , rcu Subject: [PATCH 3/7] rcu: s/boost_kthread_mutex/kthread_mutex Date: Fri, 12 Jan 2024 16:46:17 +0100 Message-Id: <20240112154621.261852-4-frederic@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240112154621.261852-1-frederic@kernel.org> References: <20240112154621.261852-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This mutex is currently protecting per node boost kthreads creation and affinity setting across CPU hotplug operations. Since the expedited kworkers will soon be split per node as well, they will be subject to the same concurrency constraints against hotplug. Therefore their creation and affinity tuning operations will be grouped with those of boost kthreads and then rely on the same mutex. To prepare for that, generalize its name. Signed-off-by: Frederic Weisbecker --- kernel/rcu/tree.c | 2 +- kernel/rcu/tree.h | 2 +- kernel/rcu/tree_plugin.h | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 5cd90f1762e9..0c818e75e8e2 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4929,7 +4929,7 @@ static void __init rcu_init_one(void) init_waitqueue_head(&rnp->exp_wq[2]); init_waitqueue_head(&rnp->exp_wq[3]); spin_lock_init(&rnp->exp_lock); - mutex_init(&rnp->boost_kthread_mutex); + mutex_init(&rnp->kthread_mutex); raw_spin_lock_init(&rnp->exp_poll_lock); rnp->exp_seq_poll_rq = RCU_GET_STATE_COMPLETED; INIT_WORK(&rnp->exp_poll_wq, sync_rcu_do_polled_gp); diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index e9821a8422db..13e7b0d907ab 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h @@ -113,7 +113,7 @@ struct rcu_node { /* side effect, not as a lock. */ unsigned long boost_time; /* When to start boosting (jiffies). */ - struct mutex boost_kthread_mutex; + struct mutex kthread_mutex; /* Exclusion for thread spawning and affinity */ /* manipulation. */ struct task_struct *boost_kthread_task; diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 41021080ad25..0d307674915c 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -1195,7 +1195,7 @@ static void rcu_spawn_one_boost_kthread(struct rcu_node *rnp) struct sched_param sp; struct task_struct *t; - mutex_lock(&rnp->boost_kthread_mutex); + mutex_lock(&rnp->kthread_mutex); if (rnp->boost_kthread_task || !rcu_scheduler_fully_active) goto out; @@ -1212,7 +1212,7 @@ static void rcu_spawn_one_boost_kthread(struct rcu_node *rnp) wake_up_process(t); /* get to TASK_INTERRUPTIBLE quickly. */ out: - mutex_unlock(&rnp->boost_kthread_mutex); + mutex_unlock(&rnp->kthread_mutex); } /* @@ -1224,7 +1224,7 @@ static void rcu_spawn_one_boost_kthread(struct rcu_node *rnp) * no outgoing CPU. If there are no CPUs left in the affinity set, * this function allows the kthread to execute on any CPU. * - * Any future concurrent calls are serialized via ->boost_kthread_mutex. + * Any future concurrent calls are serialized via ->kthread_mutex. */ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) { @@ -1237,7 +1237,7 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) return; if (!zalloc_cpumask_var(&cm, GFP_KERNEL)) return; - mutex_lock(&rnp->boost_kthread_mutex); + mutex_lock(&rnp->kthread_mutex); mask = rcu_rnp_online_cpus(rnp); for_each_leaf_node_possible_cpu(rnp, cpu) if ((mask & leaf_node_cpu_bit(rnp, cpu)) && @@ -1250,7 +1250,7 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) cpumask_clear_cpu(outgoingcpu, cm); } set_cpus_allowed_ptr(t, cm); - mutex_unlock(&rnp->boost_kthread_mutex); + mutex_unlock(&rnp->kthread_mutex); free_cpumask_var(cm); } -- 2.34.1