Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2376853rwb; Sun, 4 Sep 2022 14:43:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR7QpA2SXkpBpVLF8cfPoPYDB8ko1iSyLMXaYtjby7mDGvtf8Ep8P89ti1fa9tCLYVZp0p59 X-Received: by 2002:aa7:c70f:0:b0:447:cf74:9d2f with SMTP id i15-20020aa7c70f000000b00447cf749d2fmr38790332edq.229.1662327782481; Sun, 04 Sep 2022 14:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662327782; cv=none; d=google.com; s=arc-20160816; b=DCfizKdcTuu6woqPmtiH/OvFOTD/k9nMZr05mEL9noacFvQilGDS7vNAZDQafgSXPt BaFFO9p9t1/dtnb+0khGRGZLQRAc1TlvxIH1p2gNf6jvk6iuqeDBLnB+V9esLeMFUxaF u0G6yKvF1MjlNjdpPQa+3p00AoGHJBMGzln9gZfgHB9mkxRNtcW4EZ2iyGxki7Il7+cD FamcIczqazxmAGQM2pwWaM9OHoZjgvuGpSHDpRpnL5UQa9E/SZVarPkTsfhIgSeZ5t4g R6/zQmfjpnUPI8zvQLyLzttXTtG6PtLdZw/mpX96/0FeCj0AO4x63b+kP/ON6OySETy8 ea3Q== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=dcEg+vLNIZvIYS/EGTr2f4veEYXgKA2FC44yU655psw=; b=Kg7qnMVrIbnpCn7lp1o9RmNlLslYGL+tXLGBeyWDbuJeN28E7zO/e7fLEjKFYSqNiV CX98WxfvAI+Yp1rPrdseEhEbVSPGNJ9DtR0sVMPrSX29SXoiZoh/NeJFoPvItICf3d42 4gR67w1t2ANWE0Uc7EncURNP3tU/C1yLC5MMluaaUtPHKjuxfWe4PaiXuwzipqvhval6 PbT374z1j4VUvGEWTZOMB7hihfGA/UhztHUb+Q4l0oOU28L9d1frOJ2hJoK32tGzUpDY Mkc2kN23g8nWr3PuRadCw6FT1+Nz6PiWey3+SQ/AEksjY0zHomVqNQ3jsbaeDILNGeK4 oMaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MG3gYYfZ; 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 h11-20020a056402280b00b00447cb9f8cacsi6628426ede.336.2022.09.04.14.42.29; Sun, 04 Sep 2022 14:43:02 -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=MG3gYYfZ; 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 S230090AbiIDVBj (ORCPT + 99 others); Sun, 4 Sep 2022 17:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbiIDVBi (ORCPT ); Sun, 4 Sep 2022 17:01:38 -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 5261B2870C; Sun, 4 Sep 2022 14:01:37 -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 DE88561018; Sun, 4 Sep 2022 21:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA58DC433D6; Sun, 4 Sep 2022 21:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662325296; bh=eMJUB1gy+kxLJqRVw1Z/bd/e2b4QxmsudxdCqmT87wk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MG3gYYfZAXBsoxy72zSrFZEDlCJ/iKqdbn1FOuYNJQOnd+yT/5wmCcfLNN0IlTmp1 qK7LNbnuGbRO6CbCrddF5DMAa75abGY2H+39oSFoQGMMXVmVHqeUzCst0XQW3QwbcI nIpnVgVXeHUUGdJUZf8PgU7ZbsAfhgJbKWaP7WcZiN84hqCygVdUOW//UZQNX+e6PQ WvEzk/JeZy60hbZqF1jAj6Q+pZ34eqv7YN2AINuk3wt2I6+m8YsjjctLk8yRABGtGY FaBIWXQGa4BHayy5JzG9qBGyZZQFweTC2D68x+o82GrjD1Ycao9VgnqTmoXgmBq1vn XLHT/M/Oame6Q== Date: Sun, 4 Sep 2022 23:01:33 +0200 From: Frederic Weisbecker To: Joel Fernandes Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, rushikesh.s.kadam@intel.com, urezki@gmail.com, neeraj.iitr10@gmail.com, paulmck@kernel.org, rostedt@goodmis.org, vineeth@bitbyteword.org, boqun.feng@gmail.com Subject: Re: [PATCH v5 06/18] rcu: Introduce call_rcu_lazy() API implementation Message-ID: <20220904210133.GA149888@lothringen> References: <20220901221720.1105021-1-joel@joelfernandes.org> <20220901221720.1105021-7-joel@joelfernandes.org> <20220902152132.GA115525@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 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 Sat, Sep 03, 2022 at 10:00:29PM +0000, Joel Fernandes wrote: > On Fri, Sep 02, 2022 at 05:21:32PM +0200, Frederic Weisbecker wrote: > + > + raw_spin_lock_irqsave(&my_rdp->nocb_gp_lock, flags); This is locking during the whole group iteration potentially contending call_rcu(), idle loop, resume to userspace on all rdp in the group... How about not overwriting timers instead and only set the RCU_NOCB_WAKE_LAZY timer when it is previously in RCU_NOCB_WAKE_NOT state? After all if the timer is armed, it's because we have regular callbacks queued and thus we don't need to wait before processing the lazy callbacks since we are going to start a grace period anyway. Thanks. > list_for_each_entry_rcu(rdp, &my_rdp->nocb_head_rdp, nocb_entry_rdp, 1) { > bool needwake_state = false; > bool flush_bypass = false; > @@ -855,14 +870,15 @@ static void nocb_gp_wait(struct rcu_data *my_rdp) > // If bypass list only has lazy CBs. Add a deferred > // lazy wake up. > if (lazy && !bypass) { > - wake_nocb_gp_defer(my_rdp, RCU_NOCB_WAKE_LAZY, > + wake_nocb_gp_defer_locked(my_rdp, RCU_NOCB_WAKE_LAZY, > TPS("WakeLazyIsDeferred")); > // Otherwise add a deferred bypass wake up. > } else if (bypass) { > - wake_nocb_gp_defer(my_rdp, RCU_NOCB_WAKE_BYPASS, > + wake_nocb_gp_defer_locked(my_rdp, RCU_NOCB_WAKE_BYPASS, > TPS("WakeBypassIsDeferred")); > } > } > + raw_spin_unlock_irqrestore(&my_rdp->nocb_gp_lock, flags); > > if (rcu_nocb_poll) { > /* Polling, so trace if first poll in the series. */ > -- > 2.37.2.789.g6183377224-goog >