From patchwork Wed Oct 19 22:46:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 5884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp570484wrs; Wed, 19 Oct 2022 15:47:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GSpCBy9pXuhPZkPXLfAIQYdDgpSzjR/z5GJSqkc+9YZKmMut+p66lrWkoVrhIXqDfDv0g X-Received: by 2002:a17:90b:4b89:b0:20a:c168:6865 with SMTP id lr9-20020a17090b4b8900b0020ac1686865mr12312845pjb.130.1666219677451; Wed, 19 Oct 2022 15:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666219677; cv=none; d=google.com; s=arc-20160816; b=mLUhyi6JDZtCtRUqLRDslvudUf65VVRb6fJynNO4vh+m46OBAZTRBEqqjCdyOcJVIq BAA25tNaWMeGYNHyqsvmTgQGAtxY9hVqvAiTa3eoAuO3JlnVE23GXGk+Y9HMT3wiEohN jxaXXdIKVBwI1iEBFvpDkDS+jjpfhNE3ht22lTmxp4hrdCnedofZoE94JA4pWFQr0kje N7EZxhjV25Kg0+nojRbuY4jlFvUOyPkKmSfTj1/2q472A6ASsHUq85Wp49owCJqvGlA1 eM0PWY/93uBlNZRp/Dcu5k5wrBuOJOF8kpoU2G1J4d0szv1Bgf2mcRSwuAwz2SmoMtX9 nFmA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SLt14/p6S8YXw7EwYPmmgLnzbzUwKbWEJ5hkMWhd9VM=; b=KK0a8oYOiQYIaLB2r0mhhWaTNSdMwTy7fR59pcvnb0cecmshNZNUJ2glEcZYnywrXA PFJsq8JnDjNWDgMYzNGIiYHMHGhnToPgldeetGJjv5QfyZIXllRDXy3wmgN7Gsbz+LIk vVDVa5ZWdX92a58GO7dUF98eRAoCe7mQl/+vj9euw8iZvXf7Dt6W1RsJwtduR0EZJMyv d+oyb2IO73NktBI22cd3ZWkgmQJ3gMphloCMoaqrEuMXZINFIP9mWjiwrFJXqsvD009j XthFObmltqOiD0azkIfFtBaClCPwq//0/5HttGsHMfYH7QU+svsOwf/THaY3TNHWrnkj Oe8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MDQYW34t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020a631510000000b004386a1ebe70si19150388pgl.43.2022.10.19.15.47.45; Wed, 19 Oct 2022 15:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MDQYW34t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230192AbiJSWrN (ORCPT + 99 others); Wed, 19 Oct 2022 18:47:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230235AbiJSWrD (ORCPT ); Wed, 19 Oct 2022 18:47:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CE62188107; Wed, 19 Oct 2022 15:47:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88595619E5; Wed, 19 Oct 2022 22:47:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E601EC433C1; Wed, 19 Oct 2022 22:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666219621; bh=Ygtgs0PHtrfe91imqGDUAOtSTrIZREFcGSd4BCKgdo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDQYW34tUukSZiX8K55GD3wJ5gibLdND5HFZUo8qjQ3KQ7iMdSFIbxKJopZ6jw13B Fe9D657uTPDoZEbvaEEiK1aNR2w5t4ORXEOpjyPcautM9bICAH7PVP7nr9GZy3zmQV SpbqN56G5zFTHsB/mAaZUZAbadveQ+Q9TPMlpH1AVliutFzGqxAhvMHOLNnh32uruG 0tcL1XtCEojAV5R3jWM6dGfk5Ucjbcb+gOlsf+31yVcECbcc2wlyzpgodfvNR2FDmD yHt8Ru3lc593r6juGUX71bZt4y2Wo53LyHCqSOmaeslA266I7PWMG2RNeCnxC9MhCl CfK73ddbVu4tw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A393B5C06B4; Wed, 19 Oct 2022 15:47:00 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org, Zqiang , "Paul E . McKenney" Subject: [PATCH rcu 1/8] rcu: Remove duplicate RCU exp QS report from rcu_report_dead() Date: Wed, 19 Oct 2022 15:46:52 -0700 Message-Id: <20221019224659.2499511-1-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20221019224652.GA2499358@paulmck-ThinkPad-P17-Gen-1> References: <20221019224652.GA2499358@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747157964332451684?= X-GMAIL-MSGID: =?utf-8?q?1747157964332451684?= From: Zqiang The rcu_report_dead() function invokes rcu_report_exp_rdp() in order to force an immediate expedited quiescent state on the outgoing CPU, and then it invokes rcu_preempt_deferred_qs() to provide any required deferred quiescent state of either sort. Because the call to rcu_preempt_deferred_qs() provides the expedited RCU quiescent state if requested, the call to rcu_report_exp_rdp() is potentially redundant. One possible issue is a concurrent start of a new expedited RCU grace period, but this situation is already handled correctly by __sync_rcu_exp_select_node_cpus(). This function will detect that the CPU is going offline via the error return from its call to smp_call_function_single(). In that case, it will retry, and eventually stop retrying due to rcu_report_exp_rdp() clearing the ->qsmaskinitnext bit corresponding to the target CPU. As a result, __sync_rcu_exp_select_node_cpus() will report the necessary quiescent state after dealing with any remaining CPU. This change assumes that control does not enter rcu_report_dead() within an RCU read-side critical section, but then again, the surviving call to rcu_preempt_deferred_qs() has always made this assumption. This commit therefore removes the call to rcu_report_exp_rdp(), thus relying on rcu_preempt_deferred_qs() to handle both normal and expedited quiescent states. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 6bb8e72bc8151..0ca21ac0f0648 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4276,8 +4276,6 @@ void rcu_report_dead(unsigned int cpu) // Do any dangling deferred wakeups. do_nocb_deferred_wakeup(rdp); - /* QS for any half-done expedited grace period. */ - rcu_report_exp_rdp(rdp); rcu_preempt_deferred_qs(current); /* Remove outgoing CPU from mask in the leaf rcu_node structure. */