Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2380119rdd; Fri, 12 Jan 2024 07:47:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ6XeWOQOFI1ytb35AHxmhfZ2sJeuOx/S3EzZcmKBhdIVf1uENZ0+9dbylYk7drmcCSEGF X-Received: by 2002:a17:902:ce8e:b0:1d4:8727:76c7 with SMTP id f14-20020a170902ce8e00b001d4872776c7mr1362103plg.85.1705074450962; Fri, 12 Jan 2024 07:47:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705074450; cv=none; d=google.com; s=arc-20160816; b=xRhDrqAlk7zPRtCpJUBvXU+V5rwr2rkTEEKYFP32dsaeFNW6rQkWZiQ3xOb2/dR4q/ +zYynSoBoO9vfkmPV54iynQf2b0t0cT+B5PaQVtT3bw7V6KoiP0zyMdjC++5nBeNqszq JHJcJfU+ywtlS1DsYUd+6bq5s6tx81OvxNvCXFLKhp9h+JF7sjFtQVDv3QqZWXg7em/i NKk1qOBrx9FCFeyowbvafu/5KgzHvusa5nqO3xTnNnjDZlFdroPSc2UI6M4c+gwafdZg flLIgC3LSfw9Hx1IF7QRLlr/vi1/1mJ+UAfqS0KaVaZ4tNNpSKDVZzd1l6r/2nFJIvVM TxfQ== 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=60xXNTANHvK0LzVIFT5vQXQtwrCjMWIhtZtyb1tMeSg=; fh=LxXsyjFlXk8IKpomJhOEuAfMOggTFJag//5BxskdOPA=; b=v7oo/0LcXszKqeUi8tDjJHqyeQo5pIDFb/BKbwdsBKatlThw0l10CegiRRuVoZpj2e MvzjtgCaz60/Y89OSGCtRb7Gf8arcPiQn2nf6fCnEJK9h58bi75gl0Bm1Ze4mpsElOpN dS/ZvEQDPz3eBJTvoF5BNxkoGeTn8tcxDcykQWStUJhfoJFT8THZhnFKMUW5e64LGox/ hL/52YGlBOEvswTDsYqg3ApwFKlwzaRG7IwKu32erZiYahYkc7PHsTmwCuv75MWW3FjB CM4OXcJypvlGDG62MSSYsc/XNui5g7uTxXot/oKNcco2StUUXEj8ZJQoWUvJM5ASJsIq 7j+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iWqY4Itv; spf=pass (google.com: domain of linux-kernel+bounces-24822-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24822-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 d1-20020a170902aa8100b001d54e3e3bfdsi3277438plr.404.2024.01.12.07.47.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 07:47:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24822-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=iWqY4Itv; spf=pass (google.com: domain of linux-kernel+bounces-24822-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24822-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 7F15B286EB9 for ; Fri, 12 Jan 2024 15:47:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA8CB745EC; Fri, 12 Jan 2024 15:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iWqY4Itv" 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 053B1745DD; Fri, 12 Jan 2024 15:46:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02C57C43390; Fri, 12 Jan 2024 15:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705074400; bh=eRD9p7kQfk59EpEoFx0hyM9cqrA750l1QKynzHAEjBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWqY4ItvYn/nlg+ThvpzoZmAGs/jIV+67i8VsPEXEae22c4PqUqPVjG5/Es9L9/cH MVnPX0UQ+TC1bA4tjGVTMrUmwFwpiwYZdvKA0sUDEGQtxhckBPOjSHiwtrV4V60d0o mIfeTXKDqQh3+F594UCw65oHTiXxJnWyJeCeWuZw19Hhjl0VIe56RRaLRtxnWfEVlN mdpzwcB0vahoysza8T6RAWQkAtsBDjoIDKTrA9z002TjOyLXLXTO9KeJpGa4fRmH7B UClUcnjoMyIuMgb/utu957OSGEkKyDqMOxkulGaffBmSgu2TI+dFADCASmJrPsLD9i 360pRstM54iNg== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Boqun Feng , Joel Fernandes , Neeraj Upadhyay , "Paul E . McKenney" , Uladzislau Rezki , rcu Subject: [PATCH 4/7] rcu/exp: Move expedited kthread worker creation functions above rcutree_prepare_cpu() Date: Fri, 12 Jan 2024 16:46:18 +0100 Message-Id: <20240112154621.261852-5-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 The expedited kthread worker performing the per node initialization is going to be split into per node kthreads. As such, the future per node kthread creation will need to be called from CPU hotplug callbacks instead of an initcall, right beside the per node boost kthread creation. To prepare for that, move the kthread worker creation above rcutree_prepare_cpu() as a first step to make the review smoother for the upcoming modifications. No intended functional change. Signed-off-by: Frederic Weisbecker --- kernel/rcu/tree.c | 96 +++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 0c818e75e8e2..8f4fc8882e93 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4405,6 +4405,54 @@ rcu_boot_init_percpu_data(int cpu) rcu_boot_init_nocb_percpu_data(rdp); } +#ifdef CONFIG_RCU_EXP_KTHREAD +struct kthread_worker *rcu_exp_gp_kworker; +struct kthread_worker *rcu_exp_par_gp_kworker; + +static void __init rcu_start_exp_gp_kworkers(void) +{ + const char *par_gp_kworker_name = "rcu_exp_par_gp_kthread_worker"; + const char *gp_kworker_name = "rcu_exp_gp_kthread_worker"; + struct sched_param param = { .sched_priority = kthread_prio }; + + rcu_exp_gp_kworker = kthread_create_worker(0, gp_kworker_name); + if (IS_ERR_OR_NULL(rcu_exp_gp_kworker)) { + pr_err("Failed to create %s!\n", gp_kworker_name); + rcu_exp_gp_kworker = NULL; + return; + } + + rcu_exp_par_gp_kworker = kthread_create_worker(0, par_gp_kworker_name); + if (IS_ERR_OR_NULL(rcu_exp_par_gp_kworker)) { + pr_err("Failed to create %s!\n", par_gp_kworker_name); + rcu_exp_par_gp_kworker = NULL; + kthread_destroy_worker(rcu_exp_gp_kworker); + rcu_exp_gp_kworker = NULL; + return; + } + + sched_setscheduler_nocheck(rcu_exp_gp_kworker->task, SCHED_FIFO, ¶m); + sched_setscheduler_nocheck(rcu_exp_par_gp_kworker->task, SCHED_FIFO, + ¶m); +} + +static inline void rcu_alloc_par_gp_wq(void) +{ +} +#else /* !CONFIG_RCU_EXP_KTHREAD */ +struct workqueue_struct *rcu_par_gp_wq; + +static void __init rcu_start_exp_gp_kworkers(void) +{ +} + +static inline void rcu_alloc_par_gp_wq(void) +{ + rcu_par_gp_wq = alloc_workqueue("rcu_par_gp", WQ_MEM_RECLAIM, 0); + WARN_ON(!rcu_par_gp_wq); +} +#endif /* CONFIG_RCU_EXP_KTHREAD */ + /* * Invoked early in the CPU-online process, when pretty much all services * are available. The incoming CPU is not present. @@ -4741,54 +4789,6 @@ static int rcu_pm_notify(struct notifier_block *self, return NOTIFY_OK; } -#ifdef CONFIG_RCU_EXP_KTHREAD -struct kthread_worker *rcu_exp_gp_kworker; -struct kthread_worker *rcu_exp_par_gp_kworker; - -static void __init rcu_start_exp_gp_kworkers(void) -{ - const char *par_gp_kworker_name = "rcu_exp_par_gp_kthread_worker"; - const char *gp_kworker_name = "rcu_exp_gp_kthread_worker"; - struct sched_param param = { .sched_priority = kthread_prio }; - - rcu_exp_gp_kworker = kthread_create_worker(0, gp_kworker_name); - if (IS_ERR_OR_NULL(rcu_exp_gp_kworker)) { - pr_err("Failed to create %s!\n", gp_kworker_name); - rcu_exp_gp_kworker = NULL; - return; - } - - rcu_exp_par_gp_kworker = kthread_create_worker(0, par_gp_kworker_name); - if (IS_ERR_OR_NULL(rcu_exp_par_gp_kworker)) { - pr_err("Failed to create %s!\n", par_gp_kworker_name); - rcu_exp_par_gp_kworker = NULL; - kthread_destroy_worker(rcu_exp_gp_kworker); - rcu_exp_gp_kworker = NULL; - return; - } - - sched_setscheduler_nocheck(rcu_exp_gp_kworker->task, SCHED_FIFO, ¶m); - sched_setscheduler_nocheck(rcu_exp_par_gp_kworker->task, SCHED_FIFO, - ¶m); -} - -static inline void rcu_alloc_par_gp_wq(void) -{ -} -#else /* !CONFIG_RCU_EXP_KTHREAD */ -struct workqueue_struct *rcu_par_gp_wq; - -static void __init rcu_start_exp_gp_kworkers(void) -{ -} - -static inline void rcu_alloc_par_gp_wq(void) -{ - rcu_par_gp_wq = alloc_workqueue("rcu_par_gp", WQ_MEM_RECLAIM, 0); - WARN_ON(!rcu_par_gp_wq); -} -#endif /* CONFIG_RCU_EXP_KTHREAD */ - /* * Spawn the kthreads that handle RCU's grace periods. */ -- 2.34.1