Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3404201iog; Mon, 27 Jun 2022 15:36:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tm4gPbSrR35OJDg3UXdzOz5jsMdni5YFVCBAFKEesXvuuKW76+TD1+hmtxAU96I3KDP9Yt X-Received: by 2002:a17:907:7e9a:b0:726:34df:6d28 with SMTP id qb26-20020a1709077e9a00b0072634df6d28mr15227491ejc.387.1656369401589; Mon, 27 Jun 2022 15:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656369401; cv=none; d=google.com; s=arc-20160816; b=EQ8f31kvJ9zvmcVPOOzjObsQ+hxZ0rHlMoYC8LIn2KseTH31muo6uXTl3+dh3213a5 4ETNIkUvQunjsZSsKlsyyg2yIonKrJBkVlSeKkliT6jjo9sWz2d/xq5Y4knkpc4zn6go InC8zyXEDiZp7gFAVMGwlHUUJgayYXD/xjsefQwV+F4Fi0pVjjDMRPAIsmas43z2MpYK h/yL+FWrGBgP0trZXFgt/8IDd/rZCQeQSCzVFC++cwPqKqzflIi290w7jkSxrkeekcWC hx96biqLCJyN+9tgm5n1VR8x6JDM+66kMc8ZZMKNa+vv1yLMT+xNlGeHMELjSsvccxvD 5Xfw== 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=WNL0WU4GgGNsThMZJjjCKC7jQPfKoJJThk4sCEDljh8=; b=HoizRIeiK8i0NaqS3C4ntQwOGkbM4ZihmOzlL8TfcX3prIEdXXWe4t2c/0OuJplWVU 2Lo/f7ck7OOuC6vW5xq7qh5ifMjp1RaRq1BMmaZGPwfroEY3BwvevifWlbx+dDTGsSQh aAWENK4DvtzYvu081xs3UHORUepqxYbj0MuJccQCohnWSBaeP3yyPVKe2BbAa+16VK9U YiceH8H9wnVGhrf70oqEmvPwX5c3no37b4C1K2+fTUCYjQU/mH1zK7EC9MgLGcj0Drp9 TExU9S+awY1BDaV/S4z3ZLcdtwUWh3yY9eD1TYuEzPqfjbh7UOoBtTXlclBq2BdQRq/q TTtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J3ajaKZM; 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 f20-20020a056402355400b0043774af6f0asi8201822edd.371.2022.06.27.15.36.16; Mon, 27 Jun 2022 15:36:41 -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=J3ajaKZM; 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 S242330AbiF0WEb (ORCPT + 99 others); Mon, 27 Jun 2022 18:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242847AbiF0WD1 (ORCPT ); Mon, 27 Jun 2022 18:03:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C60A91EC7C; Mon, 27 Jun 2022 15:02:09 -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 531A560EC2; Mon, 27 Jun 2022 22:02:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E0E1C34115; Mon, 27 Jun 2022 22:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656367328; bh=3y+4OUbLcC0/yZPll44HqMz1xr/6OTXCkUJnS1fTw/A=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=J3ajaKZMSj3Cuwt9hX6EvdU+h/E7LCwiFe2zCO3IdtzIhbM0jGZndYa05szBelTnc gBk7wLECxK6jA0lJ8iKdZOOUgCoyTJ1W9NlljBTjk4cXZ4bmOaOoLICZyHAVyXA/NS QyeyX+u3zWacxSBFv8I+6DFqvPdwCV4FAd2O7ucEBh7TOggbZC3G2g8aTZzzl9Pf0g 4qACbJ4yPjbNPGlHy9pInTwo2qnKZnmsqzAM4bIZLrFUVTax4NYRc5by5OzlqMWMDn rCu1qtxrkl5CMhwhjDhkvyJTAf15vWC/kmovQBR9CFaaYtWdgpDNgp14jAhSQZxeeB 1MGRYHWq858dw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 530CE5C04B1; Mon, 27 Jun 2022 15:02:07 -0700 (PDT) Date: Mon, 27 Jun 2022 15:02:07 -0700 From: "Paul E. McKenney" To: Zqiang Cc: frederic@kernel.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: Update rcu_preempt_deferred_qs() comments for no preemptible RCU Message-ID: <20220627220207.GR1790663@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220620064224.2630382-1-qiang1.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220620064224.2630382-1-qiang1.zhang@intel.com> X-Spam-Status: No, score=-7.5 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 Mon, Jun 20, 2022 at 02:42:24PM +0800, Zqiang wrote: > For no preemptible RCU, the rcu_preempt_deferred_qs() only report > expedited QS state of current CPU, since preemption does not occur > in RCU critical sections, there are no tasks insert to leaf rnp > blocked-tasks list, that is to say the tasks structure's ->rcu_blocked_node > and the leaf rnp structure's ->blkd_tasks are always empty. > > Signed-off-by: Zqiang Good catch -- that comment is quite misleading. Is the wordsmithed version shown below OK? Thanx, Paul ------------------------------------------------------------------------ commit 5ddf65777c8d0f60ff9137eef3b23dd4c77e6108 Author: Zqiang Date: Mon Jun 20 14:42:24 2022 +0800 rcu: Update rcu_preempt_deferred_qs() comments for !PREEMPT kernels In non-premptible kernels, tasks never do context switches within RCU read-side critical sections. Therefore, in such kernels, each leaf rcu_node structure's ->blkd_tasks list will always be empty. The comment on the non-preemptible version of rcu_preempt_deferred_qs() confuses this point, so this commit therefore fixes it. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 86772c95ed0ae..4152816dd29f6 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -932,10 +932,13 @@ static notrace bool rcu_preempt_need_deferred_qs(struct task_struct *t) return false; } -// Except that we do need to respond to a request by an expedited grace -// period for a quiescent state from this CPU. Note that requests from -// tasks are handled when removing the task from the blocked-tasks list -// below. +// Except that we do need to respond to a request by an expedited +// grace period for a quiescent state from this CPU. Note that in +// non-preemptible kernels, there can be no context switches within RCU +// read-side critical sections, which in turn means that the leaf rcu_node +// structure's blocked-tasks list is always empty. is therefore no need to +// actually check it. Instead, a quiescent state from this CPU suffices, +// and this function is only called from such a quiescent state. notrace void rcu_preempt_deferred_qs(struct task_struct *t) { struct rcu_data *rdp = this_cpu_ptr(&rcu_data);