Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3296419lfo; Mon, 23 May 2022 01:00:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO0aSShwM2erEsNl7E6OWhaN3sRET/Z5xdFcNM5nKcPrCbw544C3CJShTnmDfi9Uwq9ys4 X-Received: by 2002:a05:6a00:1494:b0:518:b738:5876 with SMTP id v20-20020a056a00149400b00518b7385876mr485367pfu.58.1653292815969; Mon, 23 May 2022 01:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653292815; cv=none; d=google.com; s=arc-20160816; b=NfIHYcPncxacXkviLthD24fbw+mM3M7ObuFqEj7KrkNpuf+0akEroUMeMQ9vNLb6WP 91/2C5KoGRI5p54LgpFo5jZbkpF9s6CfKkLF2lAFvzGEcWShFsoCFDeDIMtsrmZd+5+H HPuOt91LhECMfSnp6Wx9jCRIce+6syz1G0NL0Jh2RuXihiASAvAAkNDt+f2KXEgv5Kri f5aHuS7QL2pZB3JoGBRSnsOc4l9ij+4Ry/E63e2liip0H+0wqMoANX3pyQRft+8pj1qe GGhgBTyU6mUUawiuj5H07wtBkybsboYjGBn9CliXJleS9Iw3b/PMWimRBzL6VNbhtwdD 7i2w== 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=oc8KeKzzQ+ryNSEjLMf6yjJ/Y1zDzdfhGNs1iRNfEMo=; b=gBg+x8lGzxoj6RBgj75St+SaE+03P+ZHixy5Ry9n3clijH+ivNtl31Z8CWod7KccIX e7rn2votFVz9k82qRa9kAtAFYR944ESl2brDLSldnGkL9ZCD885E4otlYGJWy3tI8PJD CQ+ZkALGzeY5M6iPrih6tqUaxfeN6GSMoKksSIEGuHDrXCgiqbLWdZkmxCpEyxCR5Bpw YEz/6hM0BUz7VWDskSl4G1psYcRuLJirkugFzdEp+2pXdYvwsagtCjZeKTIyYVPA5VXv yEZmUISlhqEcKyAYLDB+kNHroEUpYZ3EnEb56/ac5h949AyEkKbHC2Zp7Ou8+7hVznsS zL0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B2ImID1Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u71-20020a63854a000000b0039f0abb51a1si9265305pgd.1.2022.05.23.01.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 01:00:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B2ImID1Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9C2566007B; Sun, 22 May 2022 23:59:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345484AbiETE4u (ORCPT + 99 others); Fri, 20 May 2022 00:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345048AbiETE4s (ORCPT ); Fri, 20 May 2022 00:56:48 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A26B52180F; Thu, 19 May 2022 21:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653022605; x=1684558605; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=db8OCYpOU9+2GEsh1+1fgkkwRuMU7Qb8PM9/UHoI+bI=; b=B2ImID1Yg90NzkcqaK7rGYEHCD2QL5NRTvYQsMg9Mopl+lTop3jkqlze 8oANbhFrvQ81FL4JmDJXLvOXS/ybx+iGaDwv3crNXIKYK7CtyeIGEdug4 kfeGvQdk6E2N5xb5EU2QEyQjv4GrSs+j7DlTz+1+fM4TgWa+E1EHsS6Ik 7so1gXKQv0F9LzIYN3fu/1ZIavVl9jsL2WdE5GsGoh/rEWZlFy+hldnw+ wh0UIY1kk9zFqn43J3wBizkndPpcHxDtWER4lN0KRVLAD2bnkisDoNsw1 KMVv5eQdfltkrJcikAq3sVmgrp74WvfWB0umeI4YD0t2XLvpzn83R+iy0 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="270073987" X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="270073987" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 21:56:45 -0700 X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="599005988" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 21:56:43 -0700 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry Date: Fri, 20 May 2022 12:56:45 +0800 Message-Id: <20220520045645.1692124-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=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 When the RCU Tasks scanning on-rq tasks, there is no need to scanning tasks which record on dyntick-idle entry, at this time, these tasks are not remain within an RCU Tasks read-side critical section. This commit skip scanning tasks which record on dyntick-idle entry in rcu_tasks_pertask(). Signed-off-by: Zqiang --- kernel/rcu/tasks.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index f6459343e4b6..7898da987581 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -206,6 +206,12 @@ static void set_tasks_gp_state(struct rcu_tasks *rtp, int newstate) rtp->gp_jiffies = jiffies; } +static bool task_is_on_dyntick_idle(struct task_struct *t) +{ + return IS_ENABLED(CONFIG_NO_HZ_FULL) && !is_idle_task(t) && + t->rcu_tasks_idle_cpu >= 0; +} + #ifndef CONFIG_TINY_RCU /* Return state name. */ static const char *tasks_gp_state_getname(struct rcu_tasks *rtp) @@ -812,7 +818,8 @@ static void rcu_tasks_pregp_step(struct list_head *hop) /* Per-task initial processing. */ static void rcu_tasks_pertask(struct task_struct *t, struct list_head *hop) { - if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t)) { + if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t) && + !task_is_on_dyntick_idle(t)) { get_task_struct(t); t->rcu_tasks_nvcsw = READ_ONCE(t->nvcsw); WRITE_ONCE(t->rcu_tasks_holdout, true); @@ -842,8 +849,7 @@ static void check_holdout_task(struct task_struct *t, if (!READ_ONCE(t->rcu_tasks_holdout) || t->rcu_tasks_nvcsw != READ_ONCE(t->nvcsw) || !READ_ONCE(t->on_rq) || - (IS_ENABLED(CONFIG_NO_HZ_FULL) && - !is_idle_task(t) && t->rcu_tasks_idle_cpu >= 0)) { + task_is_on_dyntick_idle(t)) { WRITE_ONCE(t->rcu_tasks_holdout, false); list_del_init(&t->rcu_tasks_holdout_list); put_task_struct(t); -- 2.25.1