Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp859681rwb; Tue, 4 Oct 2022 11:39:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7S3EZDOrJhZjwCLqp7rFjH6qR9D9WIxlEOamYBJYNCF6AtuoLcjiBC0imEFjFSdZh6ydu8 X-Received: by 2002:a17:907:728f:b0:78c:336b:d8c0 with SMTP id dt15-20020a170907728f00b0078c336bd8c0mr7273025ejc.429.1664908749270; Tue, 04 Oct 2022 11:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664908749; cv=none; d=google.com; s=arc-20160816; b=uXA5LLxd+ijxaYtwGZciHB2EvX88sKvtGt1z2vJx4Pr9X2WZ8Hz802+ytaMapDQhDC FQEmBg5OvqYgXaD3os5FH5TzyaF2QcABl9xE17O/IwhJsDJ1RW7wqRAF9b90Oqij/Bi+ 6UldHHZRzkyCBdzSdhiDpbdDBARTbMeWzQ60ymqmygdhPFHT0DjnC9qaWXg7uqGIGiUh CHXqfZB7B4RA+4/IZGkweTCqJSNJtwIb/kKrJhPCBu8gzvM12swlchUFEccFJAo0b0JI 1WjNJszegIlcoByvZ++R9vHqGJu9hPpG60xMM8LMU6pyJf37i1KvylnArZ9iveI7XrLy 6rig== 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=EUl61bXOOyJ55SxoruhXfw0cpfOMgTYRbN4CZTbZtLc=; b=S7axRrV5d70HDTwZoxsz2SIojAurAVZKBHstAQtGir9TD2RYyl8VPMCaH/xTkUs5tt zonSVFVA6Kcn3D76/VdYSTe2Ym2wEXgUSOZ8JBC1GVJcAr3Wug2U2WAdhPSLjd4vlIed kYk0W5Nz65XN9Vma76//nC1cA+5LdUXxMSjUSaCS+CSqdy+0ykH2mt3iIXR810Fk08vq C3Ii/f2JI9C912toXeHit4dpdLiWttMoovXqwdGZRkdG/AviwP7hPzeVys0i0egM+XW9 dgn23EQITxD9u4FHjpB66MuuqJdFvRCb2Qy9oFI1d9C0oy51iRJH6AqbvAwo1jPkR05/ qwpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tt6XjqSL; 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 hk17-20020a170906c9d100b00775dae4013csi9666622ejb.906.2022.10.04.11.38.43; Tue, 04 Oct 2022 11:39:09 -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=Tt6XjqSL; 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 S229695AbiJDS1l (ORCPT + 99 others); Tue, 4 Oct 2022 14:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiJDS1k (ORCPT ); Tue, 4 Oct 2022 14:27:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2906853D3F; Tue, 4 Oct 2022 11:27:39 -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 B540D614F6; Tue, 4 Oct 2022 18:27:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16B88C433D6; Tue, 4 Oct 2022 18:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664908058; bh=6M/LvGJFTSCvuI10ZRfPX3txBJRAZvIVtrLdartB6aM=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=Tt6XjqSLKJGWXZ+Lj7Ovyj4+H+oQFXQH9o5uqOcLFp1BAVhriRH/tXSpqPfu0OFry vwOC1SDzoSAxV3u671n+lNq7BADrttZcjfR+HJAawZMIpV/2vsYNwAtiwHO9FnTYjx 9KymlbDhYN5DcDgGNZzZ7GcmMFeEnCNNdJGi1puNl+uHDsWptBwgjnrAlB4iSBxcCy LJo/iu0Bb8RSML6JKd6/16zMUsDaM2Mjcjw2BbdHMDXde/NEhOBmyiTtQ9UaLNMPi9 p5afwioNml66VuOv3n7urN2swfKPp92q+/tNPh8ssp5WmYd6EbHoNQLftQq2QQh0b3 QNl1aUMxmPGVw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A976D5C0641; Tue, 4 Oct 2022 11:27:37 -0700 (PDT) Date: Tue, 4 Oct 2022 11:27:37 -0700 From: "Paul E. McKenney" To: Uladzislau Rezki Cc: "Joel Fernandes (Google)" , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, rushikesh.s.kadam@intel.com, neeraj.iitr10@gmail.com, frederic@kernel.org, rostedt@goodmis.org, youssefesmat@google.com, surenb@google.com Subject: Re: [PATCH v7 02/11] rcu: Make call_rcu() lazy to save power Message-ID: <20221004182737.GH4196@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20221004024157.2470238-1-joel@joelfernandes.org> <20221004024157.2470238-3-joel@joelfernandes.org> <20221004133004.GD4196@paulmck-ThinkPad-P17-Gen-1> <20221004155814.GG4196@paulmck-ThinkPad-P17-Gen-1> 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 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 Tue, Oct 04, 2022 at 06:20:03PM +0200, Uladzislau Rezki wrote: > On Tue, Oct 04, 2022 at 08:58:14AM -0700, Paul E. McKenney wrote: > > On Tue, Oct 04, 2022 at 04:53:09PM +0200, Uladzislau Rezki wrote: > > > On Tue, Oct 04, 2022 at 06:30:04AM -0700, Paul E. McKenney wrote: > > > > On Tue, Oct 04, 2022 at 01:41:38PM +0200, Uladzislau Rezki wrote: > > > > > > trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("Check")); > > > > > > rcu_nocb_lock_irqsave(rdp, flags); > > > > > > lockdep_assert_held(&rdp->nocb_lock); > > > > > > bypass_ncbs = rcu_cblist_n_cbs(&rdp->nocb_bypass); > > > > > > - if (bypass_ncbs && > > > > > > + lazy_ncbs = READ_ONCE(rdp->lazy_len); > > > > > > + > > > > > > + if (bypass_ncbs && (lazy_ncbs == bypass_ncbs) && > > > > > > + (time_after(j, READ_ONCE(rdp->nocb_bypass_first) + jiffies_till_flush) || > > > > > > + bypass_ncbs > 2 * qhimark)) { > > > > > Do you know why we want double "qhimark" threshold? It is not only this > > > > > place, there are several. I am asking because it is not expected by the > > > > > user. > > > > > > > > OK, I will bite... What does the user expect? Or, perhaps a better > > > > question, how is this choice causing the user problems? > > > > > > > Yesterday when i was checking the lazy-v6 on Android i noticed the following: > > > > > > > > > ... > > > rcuop/4-48 [006] d..1 184.780328: rcu_batch_start: rcu_preempt CBs=15572 bl=121 > > > rcuop/6-62 [000] d..1 184.796939: rcu_batch_start: rcu_preempt CBs=21503 bl=167 > > > rcuop/6-62 [003] d..1 184.800706: rcu_batch_start: rcu_preempt CBs=24677 bl=192 > > > rcuop/6-62 [005] d..1 184.803773: rcu_batch_start: rcu_preempt CBs=27117 bl=211 > > > rcuop/6-62 [005] d..1 184.805732: rcu_batch_start: rcu_preempt CBs=22391 bl=174 > > > rcuop/6-62 [005] d..1 184.809083: rcu_batch_start: rcu_preempt CBs=12554 bl=98 > > > rcuop/6-62 [005] d..1 184.824228: rcu_batch_start: rcu_preempt CBs=16177 bl=126 > > > rcuop/4-48 [006] d..1 184.836193: rcu_batch_start: rcu_preempt CBs=24129 bl=188 > > > rcuop/4-48 [006] d..1 184.844147: rcu_batch_start: rcu_preempt CBs=25854 bl=201 > > > rcuop/4-48 [006] d..1 184.847257: rcu_batch_start: rcu_preempt CBs=21328 bl=166 > > > rcuop/4-48 [006] d..1 184.852128: rcu_batch_start: rcu_preempt CBs=21710 bl=169 > > > ... > > > > > > > > > On my device the "qhimark" is set to: > > > > > > > > > XQ-CT54:/sys/module/rcutree/parameters # cat qhimark > > > 10000 > > > XQ-CT54:/sys/module/rcutree/parameters # > > > > > > > > > so i expect that once we pass 10 000 callbacks threshold the flush > > > should occur. This parameter gives us an opportunity to control a > > > memory that should be reclaimed sooner or later. > > > > I did understand that you were surprised. > > > > But what problem did this cause other than you being surprised? > > > It is not about surprising. It is about expectation. So if i set a > threshold to 100 i expect it that around 100 callbacks my memory will > be reclaimed. But the resolution is 2 * 100 in fact. > > I am not aware about any issues with it. I just noticed such behaviour > during testing. Whew!!! This value was arrived at when tuning this code to best deal with callback floods. Thanx, Paul