Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4341982pxu; Mon, 12 Oct 2020 16:52:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUVoZUjC+69WLSvFDRnLt063teQyTQ+nFZvmQihwoz7lnppftYWtMHtGo6/eduUeBwe7jX X-Received: by 2002:a50:8745:: with SMTP id 5mr16696937edv.49.1602546778549; Mon, 12 Oct 2020 16:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602546778; cv=none; d=google.com; s=arc-20160816; b=YmXAorzQx0GTWZAPkLVAzzdDTLX/OJto4WrwatqhrDSsxtmbS7jZz7TRGFOe0nn/aN YWTod+pksqXpDxhJvXqUvEf9y9mN/co8pzhOL2cVzPQP15Z+66vCF5T1TJCTL9yWs9gz wzavPPzK4HPU8wq4m5CHaePh91AP+qNxOP9d9hVOZyVNQoZ8UKUoX+3pmv/FjCt8riqa v4onrdSOGyrrmQfTfdtCqfVICdAqOUJ7MA+KdB8DYhElkcTPtMNFI+45Jih9Gu/Xoeii R0kOHnckyM11+hAJZj069ynlpIZS0g2pherhqYKTiLUd+HVBr4SXq2flXdV7HTf6MytL O2JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=OCXPTeEfxNo+LWhlHYkJy+W39Co1V3t4OnkITQ2a2Ew=; b=TV1uIYxQy9ba8Aw2YmYx9AhyhjSUu6q038jmmsYCa/MBfFFecnqICocNF7Vd0a9mpK lSgMj6nzPJeupCPDf/GtwjYWWW+FOXehGlIgWU0yZfiBlS5LoqgkodXHw8vTLe+c53GO ZNo1+NLS8ztXiQXiFcTTR2C3eghs4vabmTLB2sJjiK06MA29SwsDuzE61Y+Lh9+cRspk vTvSS6sP9nyc5DXhncm318A12hPz0/9jVh1zP4vS2yLSiXXTiK3sfbBZ/2fy5mmJI4Tj bT7uJYu77ja1p0E3j4S+GcFQNsefXuCuXgXXMAaYkVE4lT8q+cfYZC52eyNIC5mZUQBK xFJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XAugCkaR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rk19si13061532ejb.270.2020.10.12.16.52.35; Mon, 12 Oct 2020 16:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XAugCkaR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390027AbgJLNve (ORCPT + 99 others); Mon, 12 Oct 2020 09:51:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:58162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389796AbgJLNuD (ORCPT ); Mon, 12 Oct 2020 09:50:03 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-104-11.bvtn.or.frontiernet.net [50.39.104.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EBAF220679; Mon, 12 Oct 2020 13:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510603; bh=7X8bVdnQgnIMzhQQANV8paL2JOnyHOjTZlmsrZklMVc=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=XAugCkaRzTdRLkMSYNvaddNMFMx4h/puIWOU9hkx5tYisS/v49Pkx7k7z6Ioa9fm9 rF9CqiVNKmPRRgFoh+YReZfZ6iueuKUT+pvVn3NJskyItQCI5V8IoDF7qIBgxdJCeq 4gI2YQU0Ba7UwXmUq7Z8G1RmuxprcMSOrMY8GcwU= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 9E2CC352272C; Mon, 12 Oct 2020 06:50:02 -0700 (PDT) Date: Mon, 12 Oct 2020 06:50:02 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: Frederic Weisbecker , LKML , Ingo Molnar , Josh Triplett , Lai Jiangshan , Madhuparna Bhowmik , Mathieu Desnoyers , Neeraj upadhyay , rcu , Steven Rostedt , "Uladzislau Rezki (Sony)" Subject: Re: [PATCH v6 1/4] rcu/tree: Make rcu_do_batch count how many callbacks were executed Message-ID: <20201012135002.GB3249@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200923152211.2403352-1-joel@joelfernandes.org> <20200923152211.2403352-2-joel@joelfernandes.org> <20201009231409.GA120772@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 11, 2020 at 09:35:37AM -0700, Joel Fernandes wrote: > On Fri, Oct 9, 2020 at 4:14 PM Frederic Weisbecker wrote: > > > > On Wed, Sep 23, 2020 at 11:22:08AM -0400, Joel Fernandes (Google) wrote: > > > Currently, rcu_do_batch() depends on the unsegmented callback list's len field > > > to know how many CBs are executed. This fields counts down from 0 as CBs are > > > dequeued. It is possible that all CBs could not be run because of reaching > > > limits in which case the remaining unexecuted callbacks are requeued in the > > > CPU's segcblist. > > > > > > The number of callbacks that were not requeued are then the negative count (how > > > many CBs were run) stored in the rcl->len which has been counting down on every > > > dequeue. This negative count is then added to the per-cpu segmented callback > > > list's to correct its count. > > > > > > Such a design works against future efforts to track the length of each segment > > > of the segmented callback list. The reason is because > > > rcu_segcblist_extract_done_cbs() will be populating the unsegmented callback > > > list's length field (rcl->len) during extraction. > > > Also, the design of counting down from 0 is confusing and error-prone IMHO. > > > > Right :) > > :) > > > > This commit therefore explicitly counts have many callbacks were executed in > > > > s/have/how > > > > > rcu_do_batch() itself, and uses that to update the per-CPU segcb list's ->len > > > field, without relying on the negativity of rcl->len. > > > > > > Signed-off-by: Joel Fernandes (Google) > > > > Reviewed-by: Frederic Weisbecker > > Thanks! Paul would be Ok to make the minor fixup s/have/how/ that > Frederic pointed? But of course! I was waiting until Frederic gets them all reviewed, with an eye to applying and wordsmithing them as a set. > - Joel > (Due to COVID issues at home, I'm intermittently working so advance > apologies for slow replies.) And I hope that this is going as well as it possibly can! Thanx, Paul