Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp140722imi; Thu, 21 Jul 2022 17:54:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tGIowRy0bLOxrFtPMMw98mf9cfhCIaaAcijp/3uza7Q2x7pL8OzBO72kelJM5XVrnXNDpJ X-Received: by 2002:a17:907:3f9d:b0:72f:4645:1718 with SMTP id hr29-20020a1709073f9d00b0072f46451718mr944157ejc.317.1658451256446; Thu, 21 Jul 2022 17:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658451256; cv=none; d=google.com; s=arc-20160816; b=Au/iV5k//k0RQrux9y7MksanuyeYvuSv8NBpDbYNRCPKqnkQjFuwS3gQlVqQeVxWIt R6KInwsHaUIVhkhtcT5rA1ftC3yc/ERXZ8Hdreak8BcEftNNwEAvwIM02VZongUE4i9L 4EolM4EBcstAiseYV7Ivno2pf+a3troGxTG0w6TC0DThp35IXAqb0IO+4AYJkBcKIV1V uFVILj5x/RcDAFgPRDEIU2Ikxqon/PVbYAZU3FeLPIqqrYpxa6mkXvxfOEuFVl7cme5e 2VJTE+6tivluZm2rfCHhGgRett1nC4DCB/hOOXply65VzFunu0DroR9jQe0jsMwBI+Ht gEKg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=mMmZcfXIdXcFJaJrPlD3EMfk5gn9e9Toczj/fn/USJU=; b=OL8K1+1w90Qcvc5uUXugeDcM6eoN7zTJJY8/XhA9WmMAjZFEt0iQA2KFCAsY/wEW+l 9sDpspMfzkv+2bjHY3HnttBxJUkt69KcjrINzJak3csSng8XC7s9M8sME88SykTRJivB P1LaLjnp7/kCQxck6gc5+CB6y7SLc1pb5vK1d74bH4Kx9x8551f6j4kuTrN7rmWQGbQC w/J7y82qP2tUHo6cfTWQm7S/qH6le+xENa/fqPBLBqy4Rz8ORhT/ewXZmkrSve/4h+SZ YJ2icVgi5DUi14XvOGIDusA5nHMGK6n6XFtFUw8Daqe+u+1Ftediez/xNvibkJPY2Uga OG6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Fc217rCG; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a170906974b00b006fed9376071si4921535ejy.13.2022.07.21.17.53.52; Thu, 21 Jul 2022 17:54:16 -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=@intel.com header.s=Intel header.b=Fc217rCG; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233210AbiGVArg (ORCPT + 99 others); Thu, 21 Jul 2022 20:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbiGVAre (ORCPT ); Thu, 21 Jul 2022 20:47:34 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F223695C34; Thu, 21 Jul 2022 17:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658450854; x=1689986854; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HBJqZGyWi9totiLB0aQgThUb1NiiNeVNF5WEw5qkAzU=; b=Fc217rCG75hflZYUUaf+SXGKcNg8UGhS7SKodAsiEJ050oep+mrlLQCw 0jbmB4i9TbG8QHgUdi8FeAidwGq1nUz48hESpFWY06X9n8mYau+aHAYRv rgKfqsr2UOvzyAXnD4plCA4WqSEJUqP2lO33BbiO5K1as2y1SLs6zEkzJ IthysamgPQNXGpJtQT6827K/9xyXdsZHqyk5H2dDLUhZ1oASGqP0YMGj/ nqSM8chCsDvOL0BW0T7yYkXrPQ7e9CZaKgHxUY5YrV8qE7nUyrMhwzz6v bbmB9ghdftDn3iw6HUWaXGkV9rNco9iyEP5TTUDoy6A+rwQbrYz2kEODI g==; X-IronPort-AV: E=McAfee;i="6400,9594,10415"; a="288377322" X-IronPort-AV: E=Sophos;i="5.93,184,1654585200"; d="scan'208";a="288377322" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2022 17:47:24 -0700 X-IronPort-AV: E=Sophos;i="5.93,184,1654585200"; d="scan'208";a="656997021" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2022 17:47:23 -0700 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org, quic_neeraju@quicinc.com Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rcu: Only check tasks blocked on leaf rcu_nodes for PREEMPT_RCU Date: Fri, 22 Jul 2022 08:52:13 +0800 Message-Id: <20220722005213.3511188-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 In PREEMPT_RCU kernel, for multi-node rcu tree, if the RCU read critical section is preempted, the current task are only queued leaf rcu_node blkd list, for single-node rcu tree, the root node is also leaf node. This commit add rcu_is_leaf_node() to filter out checks for non-leaf rcu_node. Signed-off-by: Zqiang --- kernel/rcu/tree_plugin.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index b2219577fbe2..a9df11ec65af 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -693,6 +693,8 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp) RCU_LOCKDEP_WARN(preemptible(), "rcu_preempt_check_blocked_tasks() invoked with preemption enabled!!!\n"); raw_lockdep_assert_held_rcu_node(rnp); + if (!rcu_is_leaf_node(rnp)) + goto end; if (WARN_ON_ONCE(rcu_preempt_blocked_readers_cgp(rnp))) dump_blkd_tasks(rnp, 10); if (rcu_preempt_has_tasks(rnp) && @@ -703,6 +705,7 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp) trace_rcu_unlock_preempted_task(TPS("rcu_preempt-GPS"), rnp->gp_seq, t->pid); } +end: WARN_ON_ONCE(rnp->qsmask); } @@ -1178,7 +1181,8 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags) */ static void rcu_preempt_boost_start_gp(struct rcu_node *rnp) { - rnp->boost_time = jiffies + RCU_BOOST_DELAY_JIFFIES; + if (rcu_is_leaf_node(rnp)) + rnp->boost_time = jiffies + RCU_BOOST_DELAY_JIFFIES; } /* -- 2.25.1