Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1652428ioo; Sun, 22 May 2022 23:05:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4ySTgj00qiTMht/Ckt1IRUH7dw+EmhfhCUd32L6CFmXBaRtRse0Y9TB1HLpr3ofvtsZwx X-Received: by 2002:a17:90a:5b03:b0:1df:86d4:ba27 with SMTP id o3-20020a17090a5b0300b001df86d4ba27mr24279962pji.124.1653285944054; Sun, 22 May 2022 23:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653285944; cv=none; d=google.com; s=arc-20160816; b=JDlEE4KtzsGEHMiX23h9CRfFvadU2RBZ5MBAhIOaK1c9a/A1bEO4JPF4fRjfM7yheJ 5t6C8fVtF4MJjL9OxPyyoswUxhpWpGodC6z2JZ+H57DJdheOLYDr43YL/XzJcZ26zJje f7/+NCyVhDndk/LDip+66ppABxQrVJVDSlq2n3sTZ5NNIRyEdKf2Z1rkbdz2M4yt71EI NHll/QCy+DnhdAUHFjnBs8k9bquvnwoViyn7Q+f78ieE5hTPN4h3Prk3UpTHYeOaeABX tzEf13lA3pB7tsnvfOa1q1pSGRgHnmOMUwQUa8F2RtwTQfW6r0mNA6L9yDtCEkzN7qTb EzMw== 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=gdnASHWeGsuD0nx3y6yFPZulLdR0MXOIsbejASa/Ik0=; b=KcMtDWi9XWKG7DDgDNiOU6EY3i+KsOONLY7txSe+Rmx9KdEoQ8PBN9FmeP5QCcAGfT totl9lDLyHHXD/U7ZPGGLh12T4VjgSxwMFkRQ8q5J9pEP0I7/Fxy2dV2Lfden0FLo5FY EaCFXKyb2eNNjH2KF7qFdfO3ZBJwxvUO+H8SQKzXCnUNWzOVvmv2HsEAIPT79KXpfGW8 SLBgJCVkIY3ZpW57xz3X7OHarKjyvan79h8iMfuofkrxDyqmYfejGxSGJzXjnF2vGFxD nEqrJzwlgzoRnSV0dSqCLrNHdiuJLBk3bNWXxZAAVk4dqsMeLM6cCsxPtz33plI1NWXh Rdvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gkqZaK7C; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id r4-20020aa79884000000b005186df822dfsi12106133pfl.378.2022.05.22.23.05.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:05:44 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gkqZaK7C; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 C72D013DE2; Sun, 22 May 2022 22:57:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345998AbiETImG (ORCPT + 99 others); Fri, 20 May 2022 04:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347458AbiETIl5 (ORCPT ); Fri, 20 May 2022 04:41:57 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2E055485; Fri, 20 May 2022 01:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653036116; x=1684572116; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NqHGDulwUCbqHCOAD7aKEAe3Uyje2uxsYHPQO/MzEKc=; b=gkqZaK7C57x5NwX/ZWVk9KtNl7wsUfdOoK2WBmKSOt9BHw0DYCDHY3CD VWn5cuFHaah9XNjGzu+MN9wxEKjjUXEV0HJrbyKHUJeFo29zV+26lDDul pA4PavdSin6iUVHsN862uSktmqiK8JeCiHZcVIEBtz4mrzaNPWgld7WB1 oiYfyNLXGl13uvgfHt94HEukSWwOchTGwsEFFLkYGgWjiI7B+ksnvl+me TspcBhmAZTW8DQK5b4KO9/bbVrsnT9e34nziiz9W0RD7nU/NaHsWO8RNz V+jgxFkdT0bSIrNc69zhVBcxVRfnMicOQ4kORZO45v6wPoVjdwu058Vpy A==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="260121463" X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="260121463" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2022 01:41:55 -0700 X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="546581854" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2022 01:41:54 -0700 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH v2] rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry Date: Fri, 20 May 2022 16:41:55 +0800 Message-Id: <20220520084155.1745726-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(). Reported-by: kernel test robot Signed-off-by: Zqiang --- v1->v2: fix build test ERROR due to CONFIG_TASKS_RCU=n 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..7cb0f922478e 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -809,10 +809,17 @@ static void rcu_tasks_pregp_step(struct list_head *hop) synchronize_rcu(); } +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; +} + /* 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