Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2445953ioo; Mon, 23 May 2022 19:55:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSnX0FG7v8IDFLHpqVOa85ttfwoQbIPuRNRLXaTyqCnz3xsaeP+6eIhXlczqhQ+UsjymGr X-Received: by 2002:a17:907:8a1a:b0:6fe:b42f:749a with SMTP id sc26-20020a1709078a1a00b006feb42f749amr15830409ejc.451.1653360938527; Mon, 23 May 2022 19:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653360938; cv=none; d=google.com; s=arc-20160816; b=lr0OfPcvS3xF2yKMx9tFC2nY4jgmTFtIfIW2Ym25aq4K2sctdWohZyccxau8FRoCEG 7xN2TnZFY8Y6xezZK4WP4hKANlM3MuKBDUCdRs8WkYqKLSV9EWAslyTl0grfSe5wA0U/ BMfsSy0f85kv1pIuhqlBr08a3evnN3xsUugozBKk4vBmYo/e1KCUY8MlqwQEtuGgxVpY nusU5dYsfCKDU20GDW8MxFAvyqawFyFtLnocr+j2aY0U4QAX0rKrM4sSSxBuMj+ktdwN iXXoxqUyeFoNGYqd5/lpuWzo1CazgQhFYlC9gBsTyeceeYxRFR6BGu2kQmRlgVnmhf8o uPVg== 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=i3flyC+907NWOt3LDObk0IaeetD4a8R0TBsXrSChvHs=; b=VDB5wf70Cjks0j1rzAPiMpoiFSLYHCDxxcck8LQDnOI3BaIPHmINOhu6LglvBdfpS8 5DxArv0AX5yZYb494eU5YOzrOw6xO0JCJANqiesrQDk+HXGxRqh+0lJ3620LoqMATUUL V4x8S0GOgQXWUcVJtB/XhFFWK9fmgPHpd+KOA04V9z/Zv1ZUrEsTJ8rCwXLs64ZkrenX 7OIzQY0UZ8WPbLxDU/bBnVlzeh8yuBKWK8/Tff58tWPiQrWSM2CKH01JQHLpOLpZTa+R eVnQQ2Ocd3B5VrmATk4Y0ZbqTkKzjn6EjUvkvylIX88sfDOJ8ybI5nzFAAlk05EEqLjy peug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZY9dayXL; 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 gm1-20020a1709073d0100b006ff00f481c1si1253806ejc.157.2022.05.23.19.55.13; Mon, 23 May 2022 19:55:38 -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=ZY9dayXL; 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 S232270AbiEXAfG (ORCPT + 99 others); Mon, 23 May 2022 20:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232214AbiEXAfA (ORCPT ); Mon, 23 May 2022 20:35:00 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86CB99BAFA; Mon, 23 May 2022 17:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653352499; x=1684888499; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cn//lySDkZnoisvjz9SADhbX/aP26ag0T/ZF0md/lDg=; b=ZY9dayXL3bvYEu6+3b9TgGE5N6zXl3Fv09D8ZAt/PNT4DIUQbOokhQTP Av7dqC1PbbvCsZd6sRQXFzJaUev1k5kmJLhOfYk9zOd4OXQiS3XneAM/q iC3oOsf6xBqWhyr0p/IYj0ZWIkvqnmA6MhPoRAIqybFF3YdkW8GJJnu1v Y1EA5ZXRhs/UkPue6Q3JJI/VEJWZIKsgVpDql268UL9yuVRZQJXAmJvQd ZtA97VM8uPxC75Yxb3NuO9cYREPTvhSY/yX5P72en47VpqaKe4EEWjOLk mEOWqYSHbjdsice7yQn9pV6wA9QLiYCq4oQi/QCFADfUnLfk/xu0uxF+f w==; X-IronPort-AV: E=McAfee;i="6400,9594,10356"; a="273509532" X-IronPort-AV: E=Sophos;i="5.91,247,1647327600"; d="scan'208";a="273509532" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2022 17:34:59 -0700 X-IronPort-AV: E=Sophos;i="5.91,247,1647327600"; d="scan'208";a="600952749" 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; 23 May 2022 17:34:57 -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 v3 1/2] rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on dyntick-idle entry Date: Tue, 24 May 2022 08:34:53 +0800 Message-Id: <20220524003454.1887414-2-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220524003454.1887414-1-qiang1.zhang@intel.com> References: <20220524003454.1887414-1-qiang1.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 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_NONE,T_SCC_BODY_TEXT_LINE 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 When the RCU Tasks scanning on-rq tasks, there is no need to scanning no-idle tasks(have invoked rcu_user_enter()) 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 --- kernel/rcu/tasks.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 195c97e85bcb..a28337f280e4 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -809,10 +809,16 @@ 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) && 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 +848,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