From patchwork Thu Jan 28 17:12:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Weisbecker X-Patchwork-Id: 373792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72B5AC433E0 for ; Thu, 28 Jan 2021 17:15:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1ACE764DE2 for ; Thu, 28 Jan 2021 17:15:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232754AbhA1RP0 (ORCPT ); Thu, 28 Jan 2021 12:15:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:50840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232848AbhA1RNT (ORCPT ); Thu, 28 Jan 2021 12:13:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6064964E14; Thu, 28 Jan 2021 17:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611853958; bh=bJuKV1xF4+QN+4Ko8tkNbuBX1godBNZsyaQLdvK0tw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nn5QHM8vEW72Q4Y7GqQuWvsx3wTxvD/+fLR1v0gq6zfbN6NLehQ0mf8Gqz8CeUXaD ecJcVn3wuX0cwuCELniYjUz11eh4vHwJEra4L76SoSIYkJCE1aXIWPMDvpJIz2udUJ adRUie79uErTfq0ZsDxl12Bul06g/6ioF+uSv/rTEHd0AtKGEFSdcVxKyDG639FuHV IIY8jRwvyvqbsqsFX5s+gvoQkLbbfWy/dUEDJ+hyL+n5x7oSj8Ef+OrBLCTBR8VBR0 x3ODwaOOS14eUS9azml573Ib250bLN/qV92PQq6h8xv2yiG8FJVmNAEM/Q9DRt2iQk AqjxbqV176Wyg== From: Frederic Weisbecker To: "Paul E . McKenney" Cc: LKML , Frederic Weisbecker , Boqun Feng , Lai Jiangshan , Neeraj Upadhyay , Josh Triplett , Stable , Joel Fernandes Subject: [PATCH 04/16] rcu/nocb: Only (re-)initialize segcblist when needed on CPU up Date: Thu, 28 Jan 2021 18:12:10 +0100 Message-Id: <20210128171222.131380-5-frederic@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210128171222.131380-1-frederic@kernel.org> References: <20210128171222.131380-1-frederic@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Simply checking if the segcblist is enabled is enough to know if we need to initialize it or not. It's safe to check within hotplug machine. Signed-off-by: Frederic Weisbecker Cc: Josh Triplett Cc: Lai Jiangshan Cc: Joel Fernandes Cc: Neeraj Upadhyay Cc: Boqun Feng --- kernel/rcu/tree.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 4c5a1ac54fa6..f74a9ba62c12 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4066,14 +4066,13 @@ int rcutree_prepare_cpu(unsigned int cpu) rdp->dynticks_nesting = 1; /* CPU not up, no tearing. */ rcu_dynticks_eqs_online(); raw_spin_unlock_rcu_node(rnp); /* irqs remain disabled. */ + /* - * Lock in case the CB/GP kthreads are still around handling - * old callbacks. + * Only non-NOCB CPUs that didn't have early-boot callbacks need to be + * (re-)initialized. */ - rcu_nocb_lock(rdp); - if (rcu_segcblist_empty(&rdp->cblist)) /* No early-boot CBs? */ + if (!rcu_segcblist_is_enabled(&rdp->cblist)) rcu_segcblist_init(&rdp->cblist); /* Re-enable callbacks. */ - rcu_nocb_unlock(rdp); /* * Add CPU to leaf rcu_node pending-online bitmask. Any needed