Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2344940ioo; Mon, 23 May 2022 16:37:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsznTmqkkSV0t4AtAhMgW3hzQnO0vpYr1OBFBtFjzWD/yhIoXOGtsDOUTz/Y5RACmfSijJ X-Received: by 2002:a17:907:629c:b0:6e1:6ad:5dd8 with SMTP id nd28-20020a170907629c00b006e106ad5dd8mr21604773ejc.641.1653349024889; Mon, 23 May 2022 16:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653349024; cv=none; d=google.com; s=arc-20160816; b=NONfxhVGQwgDdv+bORBu+XNSGn2GT2e/dltJebhwNg/XevkSILALYKfdN7t4G1aueh WR/lc35xbjK6pqkMrbx6hMhH6STA3DpML6H0GWpid9E91/2mP9LanKSIE9rtEoS5/y32 cszMGT2Xp716DQM37jFhlkXywBpqo6htDwZKD7/znhthPOySWj6pkSUefPSSy2a/vKhP h/6yywWdrRgG8BhINIe0BXpGtprjvbJlUAYdo7yTYlSfJxfIvwfNOOFdvayB0AkHM9l9 Cc3wEvOeyCg6BTvwEteYqvG/cTVVqTjnbchIZfV5AJIWT3axCavJ0b4hkieQbdI1HjSW AttQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=oBBB5OQRMne7GyrIwIjWZ52E9zRHJOF4MZ3mKwjBWPI=; b=fGFcwmtoddwNT4LDObR092YK3WYv0lGB0DVwQWGrvO2lNHmp5bD33hnlOE15l04tg4 LnRuS80KQ1R1WvqR1w7pkUpG3X6i0/1HnTCdanswdMzY54zbTEBCmMjbMA/vweI8z2xH t4lgGgh4LRvvtdFYGU/McT6YTe+mZLCX/JCCaqo3wJp87O3CNyVbcNsywit31qDWkD99 np3L49ME1iyCItiYGRN/+5nSh38AwkE+B/zrNr5mqGkEMdUiSYh0iBbE6wUR9YzRtIGL DwEKw49v8tTl1l0eKNLpVi9Gy2mjKx2pwQ5OMlrOOlPPtPrQAgoyxms5PoY3vsA8B9HM LwSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PiBbmGDB; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a1709060f5500b006e859345c1dsi13718036ejj.439.2022.05.23.16.36.38; Mon, 23 May 2022 16:37:04 -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=PiBbmGDB; 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 S230098AbiEWXJZ (ORCPT + 99 others); Mon, 23 May 2022 19:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiEWXJW (ORCPT ); Mon, 23 May 2022 19:09:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1428D70369; Mon, 23 May 2022 16:09:22 -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 A301E6156C; Mon, 23 May 2022 23:09:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF7B6C385AA; Mon, 23 May 2022 23:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653347361; bh=yOoMYHJ+lZpOBFkfuhqaQQmv3ej6+jMUsBvs1jyRRVo=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=PiBbmGDBY2uySOT3YH++Qq0COpTcPptclkj2+PYOTSoPFjPTVw5tUqu2qrUcT26MJ JD0W4XCinFYng5fKm9UqGUzrXIIM7pekYaXUmHBuVVGzJG4doA3B7R9asg0/xBBCET sUVbec+h+8Ag4pwdNBdIyBu1RX2zsh0JGbXVFO2IChvQl/a3M3WNSoTbH1u5NMH0Eg 6QYgtZS7iVcc/23mft9gP4tgKZAK+ZNUmakf6bTFOWvfjJmLQUMFISvwGkhdejFYla wD8pKailN/NZL1uXpZs5f7xSRWkLfZ033xX6QW+XxFWB4dgR4vWraIoSGML5VYqSp+ enm7uDh5VKNHg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 8A35A5C032C; Mon, 23 May 2022 16:09:20 -0700 (PDT) Date: Mon, 23 May 2022 16:09:20 -0700 From: "Paul E. McKenney" To: Zqiang Cc: frederic@kernel.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: Re: [PATCH v2] rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry Message-ID: <20220523230920.GG1790663@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220520084155.1745726-1-qiang1.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220520084155.1745726-1-qiang1.zhang@intel.com> 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_PASS,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 On Fri, May 20, 2022 at 04:41:55PM +0800, Zqiang wrote: > 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 You lost me with this one. Doesn't the rcu_tasks_pertask() function already exclude the idle tasks that might possibly be running in dyntick-idle state in non-CONFIG_NO_HZ_FULL systems? What am I missing here? Thanx, Paul > --- > 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 >