Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp734991rwb; Tue, 4 Oct 2022 09:55:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5T4Bd5ddBhEMYSv4TNlPvp3i2B3i4bh9Gqa237o45v5vo+7sliIzdOKCHeDe4myqaoiaiO X-Received: by 2002:a05:6402:2549:b0:452:8292:b610 with SMTP id l9-20020a056402254900b004528292b610mr24289228edb.199.1664902518897; Tue, 04 Oct 2022 09:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664902518; cv=none; d=google.com; s=arc-20160816; b=On0tN/7r9pIEPoqFa28/CGWj9YkYgroMxBvZiho5LEjmdFo7YozYr11REajVvNuEDM KAwQI87V6LmcxJAbZQa5pDE/5mcIWZOvoysODQLTzJ6+hJKHmUwljD2y5tPyLWqROnhe c5F2pic+QWS1ajL6rdz5Uz9MBjLjHrHmPq81AR93amw0JvnLDFM9wgj2GTYrMbCfSLzx sNwjSsvIboUUTjkFe4vhcD9yWf6wfdTWkzKmEq080FkL1w9XVVHfEPR6qi8rpk7haTBp THoZaNOKbpC3ocPZmwg79q5HmzCxTpP//NlG29N6vKuvitjGSAXAAWHHvrR0LUSdxuN/ SNIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=JZ3iUDHSbQXvPSxh5byaUtyxn9JuSZxfLjzTGQtDdiI=; b=Tq53jVJdTQQ+5gYsvdxw1WSVMT0S1/LPv3MUamOaCiLQuXZWEFiMFauS9vSufpaQ/u KHB2mMreOGqSTsP4pche8fwxXu3pS73hwLtzoN4l/KS/G+d7WTgMwPBTMkc7KH+SXNrZ PKkQO4CbL9Cp16wIpr5N1u330oZbM4X83oyvMsLWyTSftRM4MfvCJzws7aJdrbyp8Cgu 3g0413LrKyFqanBfmj/DFXW6PKry9AGKQ902yDMLbTitFnrBCDjhSGlm2X61I4dzlDff aE4xrBmfmTUYeWFHzcCfZSjHbsCpu0ogcRSeUt1+sYvPQOnE0JxhZgahL8z+U5bfnyfe fhCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=i9R1Ftpg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he30-20020a1709073d9e00b0077fc66b581esi11979546ejc.688.2022.10.04.09.54.52; Tue, 04 Oct 2022 09:55:18 -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=@joelfernandes.org header.s=google header.b=i9R1Ftpg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbiJDQWk (ORCPT + 99 others); Tue, 4 Oct 2022 12:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiJDQWP (ORCPT ); Tue, 4 Oct 2022 12:22:15 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95D6448CBB for ; Tue, 4 Oct 2022 09:22:11 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id s9so8658548qkg.4 for ; Tue, 04 Oct 2022 09:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=JZ3iUDHSbQXvPSxh5byaUtyxn9JuSZxfLjzTGQtDdiI=; b=i9R1Ftpg4EB3iaDhSe4JE0wNr+N0VO/s0tEkp9MD9mPWT8JlfQJNtSJNoWkM9j6dNa 7xITECxQb6zYNVgAWwobDDZNOcwiE8KIAJq236+XHPfUMJHrksId3IWM7WsBszWZDKzO njhPuYo8/mtRorpBuQwPZ20upuHZf7DQCJFcM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=JZ3iUDHSbQXvPSxh5byaUtyxn9JuSZxfLjzTGQtDdiI=; b=OfhibvVe9PXFfLuj5drFi+J6nhtpcNSmmC+Orw2rfHYyVfhbhLpfs6b71YnOjPRtjR hiP7r6/2oNGdm7fXAX1pBFMHxnxaAlQE8RTfwBgYBFEbyPRFtryrDraSSuBmVuOmYJha p0E6r/nWbC2hGKBMPclfzokuCZtjb0e96O8/mQzSx3K/fgNuKsfcNxKWzYgdyt+T0VZA 3pIfDMXWImITJW9rvd5khKqZmFxQZs/eokskEerUHnupTteL/2f+DwlDFpDJL6K2KXDA D98TZU+f9xobsKnbHReUohNZz1XTYZynQr3CUIbihLQEvs3q5HLMcHMTFTzYumgpDioD Dw+Q== X-Gm-Message-State: ACrzQf1vrWwclfb2L/Woxm6B0XFJuBo4tWfzdGPNLAHvfWsfpSTBnFBn RgEd1aXqrJ3eLezVBSYclu09iA== X-Received: by 2002:a05:620a:3706:b0:6e1:dc2d:4e86 with SMTP id de6-20020a05620a370600b006e1dc2d4e86mr129443qkb.428.1664900530016; Tue, 04 Oct 2022 09:22:10 -0700 (PDT) Received: from [10.0.0.40] (c-73-148-104-166.hsd1.va.comcast.net. [73.148.104.166]) by smtp.gmail.com with ESMTPSA id u5-20020a05620a454500b006bb87c4833asm15109434qkp.109.2022.10.04.09.22.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Oct 2022 09:22:09 -0700 (PDT) Message-ID: <39cb5352-4b8d-7ca8-4414-6fbb27bab806@joelfernandes.org> Date: Tue, 4 Oct 2022 12:22:08 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v7 02/11] rcu: Make call_rcu() lazy to save power Content-Language: en-US To: Uladzislau Rezki , "Paul E. McKenney" Cc: 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 References: <20221004024157.2470238-1-joel@joelfernandes.org> <20221004024157.2470238-3-joel@joelfernandes.org> <20221004133004.GD4196@paulmck-ThinkPad-P17-Gen-1> From: Joel Fernandes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 10/4/2022 10:53 AM, 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 This looks normal to me and working as intended, due to the first flush after hitting the limit, future callbacks will not be considered lazy until the existing ones are drained out of the queue. It is possible the additional callbacks showed up before the whole queue was drained. Then add any scheduling delays to the rcuop thread etc etc. thanks, - Joel > ... > > > 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. > > -- > Uladzislau Rezki