Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2171484pxb; Fri, 25 Mar 2022 12:22:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqHfORCVBUMhUqbytUBLgiN8LJs1WVlWV+uBgqNM1jJlOTRzLazMGxdjhN65LQaYkoi4Z6 X-Received: by 2002:a17:90b:4acc:b0:1c7:f18:1141 with SMTP id mh12-20020a17090b4acc00b001c70f181141mr26505348pjb.31.1648236130142; Fri, 25 Mar 2022 12:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648236130; cv=none; d=google.com; s=arc-20160816; b=qy2GzpObJxysP2uxaEa/LerawtY23a6sVEqEl3PYJx58znuXUJvErRJo7pt4O1NNE6 1taWBaTAJ5piS7ApV2ALxb/npzI80Frp21JcvsOK3dHwICYCz4pe9ezIHlBnWJfy01bE yY3yACe4dDZTus4/g7XrqFNVVMWgl85cnVfoG4624FoVwpGr4axhhSkQ2lSCDOWzH6d+ 5luV58RmHwwoFofNM9XrYTfaV/cDCaMhgoLcw4jtG7kgmMJgNQNpVINynXogdhd/2AEE hGTxbKuFtOJS8kBHo2kXTj+pqpZwVyIcjdEZapAkzEgvCVki0TtOBXG+ckCALjAeoV8Y jmaw== 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=n13LS9z+/n6iIzddfGRY7CEmZI4NKQrX2QxZygOB7UY=; b=HO4gHT5E3NxAHoxmtjWUn+gIM16r3hqFxfuo5Bd1Wpnh1HyiVfvRDSBgy8hHDRkoMM 9sWt9lLQ/gLBsNFPU55oPA1BLl/w5jKJb2X6Jux8CzzxZjKdMA5LOz1o6gnjON2PetRo WmFTF1/XbIy7nhI6AalUUqERuTN5BfPBU2yZcFZzq+SGVU5P0slDsBAxDQs/qwFzhHPE ztQ/nTA4SlOtdiYqTdSIxa81fI2/GFHI/he3AMPhqeAYKDhUpWMTmqNrgHRRfrd2S8H+ zNnL195I0P2FXe09HnFVBdSIpsM8bI5KjVgygfZsltnt69YYPY85ww1qXCwlsXrZ6u1U 2IZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k5Na4eSW; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id lx3-20020a17090b4b0300b001bd14e03066si4222911pjb.62.2022.03.25.12.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:22:10 -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=@kernel.org header.s=k20201202 header.b=k5Na4eSW; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0E61267598; Fri, 25 Mar 2022 11:27:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348352AbiCXQBi (ORCPT + 99 others); Thu, 24 Mar 2022 12:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243557AbiCXQBh (ORCPT ); Thu, 24 Mar 2022 12:01:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B922AEE; Thu, 24 Mar 2022 09:00:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9E1CDB8244B; Thu, 24 Mar 2022 16:00:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E065C340EC; Thu, 24 Mar 2022 16:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648137602; bh=q79PIwzbW5QyaiQJBSuk3Pa/tpfdQBQe9SrvS827vms=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=k5Na4eSW+izeWfyLYrfuSc5u8bEfOXsp9mr+vV3qSgmWRiCPBwiXmxkg/2bmdzaiS 3NC/6ee9I+k8oy1xsC1EFNIWjakUKiQ2jUc5L3nMncOM1qNuzpSuI43Oj8n/wCbfCw XXjy8MaVA9Hga2onOxhQzR2Uh1KDLht2iOaZd6CuEQy/1Sdtx1eFHZ2TZEx3wS6ENr 1hc/6l0Bmjvar4MK75StKp2fzJTO6CWhvxSXXL4b0Ift6SwLahCoIYkFI2/g/rijiw RP40SpJdeoW841Hf7bwo8Pf2SVAlyhUA8hDCjgJu9sGcKXhrlul1PTLRvqz3ekMacH a52HvOQylyBBA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 823E75C0192; Thu, 24 Mar 2022 09:00:01 -0700 (PDT) Date: Thu, 24 Mar 2022 09:00:01 -0700 From: "Paul E. McKenney" To: Zqiang Cc: frederic@kernel.org, quic_neeraju@quicinc.com, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: Check the validity of the boost_kthread_task pointer Message-ID: <20220324160001.GW4285@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220324111515.1810160-1-qiang1.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220324111515.1810160-1-qiang1.zhang@intel.com> X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Thu, Mar 24, 2022 at 07:15:15PM +0800, Zqiang wrote: > The boost kthreads may spawn failed, although the probability of > creation failure is very low, in consideration of the robustness > of the code, add boost_kthread_task pointer detection. > > Signed-off-by: Zqiang Good catch! As you say, rare, but definitely worth fixing. I could not resist a bit of wordsmithing. Could you please check to see if I messed something up? Thanx, Paul ------------------------------------------------------------------------ commit ad3c438e248cbc41fe30a41287621c3dbfcdf51c Author: Zqiang Date: Thu Mar 24 19:15:15 2022 +0800 rcu: Check for successful spawn of ->boost_kthread_task For the spawning of the priority-boost kthreads can fail, improbable though this might seem. This commit therefore refrains from attemoting to initiate RCU priority boosting when The ->boost_kthread_task pointer is NULL. 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 6b9bcd45c7b2..d58f6d6073bf 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -1125,7 +1125,8 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags) __releases(rnp->lock) { raw_lockdep_assert_held_rcu_node(rnp); - if (!rcu_preempt_blocked_readers_cgp(rnp) && rnp->exp_tasks == NULL) { + if (!rnp->boost_kthread_task || + (!rcu_preempt_blocked_readers_cgp(rnp) && !rnp->exp_tasks)) { raw_spin_unlock_irqrestore_rcu_node(rnp, flags); return; }