Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6735379rdb; Tue, 2 Jan 2024 11:25:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkZYb13mesVZGPLf8teQfmj48RPS9KAhv/7Ui19a996wYQwuc4kwFBbGcqBMTEIbaBaTAT X-Received: by 2002:a05:622a:2c9:b0:427:9036:425f with SMTP id a9-20020a05622a02c900b004279036425fmr25307288qtx.11.1704223522041; Tue, 02 Jan 2024 11:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704223522; cv=none; d=google.com; s=arc-20160816; b=mx8/zrS/1HW/Xs5JebOaXUQc8BX4Dgy40rFhGikCxbJo1++9b6mL9EmJ+HL8YRlbNU RHZjinkIGd/1+zldN+/StFcx93oklQ584hnNipH2ixrZOe8Trrez6nXk+WX5XPJPN/H7 POpLD//lP5fGHaS0d4Md4DX1itAiV0yzS3ZD1RofDnlvyEsKj/0mshFkESMy0WyEXAB1 JtHad2KPOZ3FyhbrQBjIiqupmWzQGFL+0VF7xYwEXNJibqBLhJaCXgqbjOUlG2YlFuFG vdXM0pCOSg4Y4YR3lS5GsHW6AoGKnV/4J/6NvqHtkZxSZis7gMmZ7CCZMe3wrL0lr4D/ Obiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=1r3kYhrORZBSSQoVlIh5p7gK+/FEfby9w8AQaSotSZ0=; fh=qCYR4V6LEqlVZEJhM8X8I09bW6ELRZQJOr9RDkfkbYE=; b=Y/9n5dXzbfN5NU0bnJKRF02Ar1xAarSMmDhrlCP5mMWa5qeTIhP5L7sdCvo4w3Aa+e ovPwjFTFHdrl8X2Myx9JksrY9Gdg6MMB1+DxOjfZDtNKIBIMVBjs+bR3ONdxzePd/kCS WWoitH26//BTBs7oB0ikmkECZeOrcW1I0LTnuL11dw3vsnGkeGK4B/MA1a951nxhXK4Y eXVYEHW/rkuW/tet6KaZm2dNHHRaswMm+X7Q4RmY5j74zX1TuwoZtktOjBmbbLfuxEjz eZSERHq37PGJX318oPOIpOwyZxBuadETlQoQqgxT6L1SRxeOXb4cjq2eShX7yVwxMT/6 PRow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uOffRpye; spf=pass (google.com: domain of linux-kernel+bounces-14768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s16-20020a05622a019000b004281e320aedsi5271234qtw.390.2024.01.02.11.25.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 11:25:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uOffRpye; spf=pass (google.com: domain of linux-kernel+bounces-14768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C8F541C2298B for ; Tue, 2 Jan 2024 19:25:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77EAA15AFB; Tue, 2 Jan 2024 19:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uOffRpye" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA9FF15AE6; Tue, 2 Jan 2024 19:25:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 262C0C433C8; Tue, 2 Jan 2024 19:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704223514; bh=9V0vCJ4+GodEccsQMreY2i8HY2m1UiJC6KxW8j9XPZc=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=uOffRpye5Hs9O9LrEaJEqVhIOWGQrP8nAOkDtf1osHW2gP2WBsMOC+fdUesAKoFWo cYrZZyaWmEOaSw5cdFh2LmV8UQg/m+v+XymwI2jEwFakkITknX/tWBk4godrcVV68e 3G4XMWKW5auXu+reliWrGbFRkhmMXTHBttOWTAJht/i2SgacUXe+WwA8IAszJnSjII lnd6ExFhbF5RB3GeuxmU/iO0ySq/UfMfOPcqbhcxSqZSH+E6yMWBHmc2geIb1T7qGJ Hlozi8JScjT8q1nOzsbkb+eyuSMU/IloUbx74eY8srRQKUWIDp0xhVqrbttfZDhsO7 2pxpiu5PYvGcA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id ADC12CE158D; Tue, 2 Jan 2024 11:25:13 -0800 (PST) Date: Tue, 2 Jan 2024 11:25:13 -0800 From: "Paul E. McKenney" To: Uladzislau Rezki Cc: RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Oleksiy Avramchenko , Frederic Weisbecker Subject: Re: [PATCH v3 4/7] rcu: Improve handling of synchronize_rcu() users Message-ID: Reply-To: paulmck@kernel.org References: <20231128080033.288050-1-urezki@gmail.com> <20231128080033.288050-5-urezki@gmail.com> <579f86e0-e03e-4ab3-9a85-a62064bcf2a1@paulmck-laptop> <650554ca-17f6-4119-ab4e-42239c958c73@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jan 02, 2024 at 01:52:26PM +0100, Uladzislau Rezki wrote: > Hello, Paul! > > Sorry for late answer, it is because of holidays :) > > > > > > The problem is that, we are limited in number of "wait-heads" which we > > > > > add as a marker node for this/current grace period. If there are more clients > > > > > and there is no a wait-head available it means that a system, the deferred > > > > > kworker, is slow in processing callbacks, thus all wait-nodes are in use. > > > > > > > > > > That is why we need an extra grace period. Basically to repeat our try one > > > > > more time, i.e. it might be that a current grace period is not able to handle > > > > > users due to the fact that a system is doing really slow, but this is rather > > > > > a corner case and is not a problem. > > > > > > > > But in that case, the real issue is not the need for an extra grace > > > > period, but rather the need for the wakeup processing to happen, correct? > > > > Or am I missing something subtle here? > > > > > > > Basically, yes. If we had a spare dummy-node we could process the users > > > by the current GP(no need in extra). Why we may not have it - it is because > > > like you pointed: > > > > > > - wake-up issue, i.e. wake-up time + when we are on_cpu; > > > - slow list process. For example priority. The kworker is not > > > given enough CPU time to do the progress, thus "dummy-nodes" > > > are not released in time for reuse. > > > > > > Therefore, en extra GP is requested if there is a high flow of > > > synchronize_rcu() users and kworker is not able to do a progress > > > in time. > > > > > > For example 60K+ parallel synchronize_rcu() users will trigger it. > > > > OK, but what bad thing would happen if that was moved to precede the > > rcu_seq_start(&rcu_state.gp_seq)? That way, the requested grace period > > would be the same as the one that is just now starting. > > > > Something like this? > > > > start_new_poll = rcu_sr_normal_gp_init(); > > > > /* Record GP times before starting GP, hence rcu_seq_start(). */ > > rcu_seq_start(&rcu_state.gp_seq); > > ASSERT_EXCLUSIVE_WRITER(rcu_state.gp_seq); > > > I had a concern about the case when rcu_sr_normal_gp_init() handles what > we currently have, in terms of requests. Right after that there is/are > extra sync requests which invoke the start_poll_synchronize_rcu() but > since a GP has been requested before it will not request an extra one. So > "last" incoming users might not be processed. > > That is why i have placed the rcu_sr_normal_gp_init() after a gp_seq is > updated. > > I can miss something, so please comment. Apart of that we can move it > as you proposed. Couldn't that possibility be handled by a check in rcu_gp_cleanup()? Thanx, Paul