Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp281046lqs; Tue, 5 Mar 2024 01:38:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXnJfThP1DvwF/nFIsZSGKHoUx3CT9rDX9TNQQbHDuC4SCW3dUiWbpWA090k+VmrPb31MqbhWcmNvA38mWQA6/BtD1y13avCf5xgDOQjQ== X-Google-Smtp-Source: AGHT+IFrQatbGcSkHjKyPgNg6nPq4k8Ec4omkgIJwloFY3Bo/fBs0NnyFEPq88rR9yEHfSLRjd9L X-Received: by 2002:a05:6122:996:b0:4cd:44db:b24b with SMTP id g22-20020a056122099600b004cd44dbb24bmr1063480vkd.5.1709631494566; Tue, 05 Mar 2024 01:38:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709631494; cv=pass; d=google.com; s=arc-20160816; b=M97u0dcacLUHJ0S4xlCzUDnEZSkDaxgkpCM9xGkSJcRfSUK3BriMf9IYkTU2OAiOGu YqCBM2mEtkgfYFNSm5UwoUlFDz/P9IfyHENoe21JI2Dn/Qn+A9diF13MCmM0UoU522Hm jbcGv/TkvF3haN3MKx+cH/dDv79HxQyPbevR+q0Oj48RwGglZohQGFGGPzdzZM0AIqhn ykeTCmaqjpHVJpjVLCHyhBD5TsZ81lGTpjWUQRRIWNhj3N43l+yUz/mGwCjU7q6Zun4J nq6D/MvZIPt5ac890wYOqz1smLqH6bv/2JxKQvgqDC3uPCD1D9MSYvjllxAJZXhjeI0d eF+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:date:from:dkim-signature; bh=J1b3HlBoJynNHCVhwrfJ1VhOag03u56s5IVuhmH3WmA=; fh=Pglr9KNvAJJkRACwG/oPG4MkDtDz+s/qR2l/5MMx5sI=; b=w8TkjM0IJAFIPEA8dHfLa6Bzb6YZGD6lmHbfl8T5arKy15i3hAzWCdaSdaje2lhXvI CitD9lGqHO20wHPWAL44vBHNJE6OKgAkbXHvDOBZczmDOLH9y/7wcP1pYvFtbH/hRkIv OfNbuOYiFJcx1spgGrudOBOmzwuKsNIWy66LNFgeCEVGfS/Nou4/0wzktksF8lEcGUbm tdFIT4FYFVB/55THiCfR1JAX/OAdvSa8vDmESpb75egq0W1iIerLHgCeERILZ46oJPOf C3Bd2c82iOeyGQqJpU7WSc86HI8BI/Sogq68nCk3foT5+l4lfmxC9Dq3ZCQ5LfZIx0ae gRQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MzIPq2lG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-92014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jn15-20020ad45def000000b0068fc29395e5si11343616qvb.573.2024.03.05.01.38.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 01:38:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MzIPq2lG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-92014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 4A3A01C2247C for ; Tue, 5 Mar 2024 09:38:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BCEB852F97; Tue, 5 Mar 2024 09:38:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MzIPq2lG" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B90817721; Tue, 5 Mar 2024 09:38:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709631487; cv=none; b=CuzvWSqKDN4JVo+DrO4lh9fL1ACNlvAQNCru/ZaeUVcnTKrCYbh+4Gm8XQzjqXXUWZtHHrCI6f6IwWSi2ot1BPvWNk6yd9jcI73YxGAOZV6AlddYnqtmRtDtPNRW8IwJkCLEgNV2X6yUgZXwL/RwyBj3zU5FDqdPAvKvWy0vFdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709631487; c=relaxed/simple; bh=z2SRACEdEYImPDxyXMgue7032HdKMaruPutWFf7+NUA=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NZiZQoA2fOOqoUl2rHsqnXxqxli+TS7HWH8PV2z3jflU82lv4nOhxyE6Xr5rHceK1JqsLODonWXYitgALGK6U72Zs3Ar6iMIQbIXqqywxFSineo2ivCxCwrozmXK6dzMuVKvnJo9hMiTdxEYVp8zHthsR9397y62FNstCJMNDkI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MzIPq2lG; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-51340e89df1so2704431e87.1; Tue, 05 Mar 2024 01:38:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709631484; x=1710236284; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=J1b3HlBoJynNHCVhwrfJ1VhOag03u56s5IVuhmH3WmA=; b=MzIPq2lG1WnLVuHViJp81eGFKCXOwm0JYUqWExhk5GTHrOvinEfhc3ef2SoqZWTC2t sNrmog8xiE8xQTncXXYFlXrRiP082YHhLa2k+m0Gu4tqlZpq+JsZXAk14m1p2Rbv4o2T 5vqJ1px6Ty7zgVSWs21piCPP6ORx3RiRnqVngNyRc1GytM6Fw77vPSFIhCVMw6IX6/RM ExrX+jHRiB09ZjRSHi2ic2M3DBlrmTPEL0EDVYOcdxm6uo5DG5+93HDsiz8JJ3zepztI ss2yxjF43jmpqQzWBrRFEj+Lfn5xiGuYxkQ7FKgKh07m4CcjZt59hqVIY+5ZLHresDM0 3L+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709631484; x=1710236284; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=J1b3HlBoJynNHCVhwrfJ1VhOag03u56s5IVuhmH3WmA=; b=tghtkpkWj1Db9c1B0BUT8j8JpOrbwUVLE6Bd4iWsxs0S1AlrkW1WCKoiXCpuNIlrSa onj8lNnCqTLyoAccA8Mtbe1CEGe8GJeJsVFjSrdSZ+qraCWmn0lgzEBJVWvatCYzOT67 TZ/Y9pwDwPFtHzxzyDB1ASbJj/+K0DqTbmLx72fYDANACxF5gh3UfYdITrOsSgH8vJpF Jp5oZoPNpAnAxy6Bv5I1z/qG+Vp1h2SvcrBLtOSc9w0/FxZaqtmCynawzvm1WAS+W4iA P/6ZhxKGByUTPVy5R4ILgYdNTrbxzHxTuXX3ni4DagqIHUQRN02GT/foPGiLdH6V2fEk 1rAA== X-Forwarded-Encrypted: i=1; AJvYcCX30QNYqTYFlXGvnxTJVX0R2xC55JNus8YHYbGtVi2uN9XKjalUJSBW5BhCPzHQjKgB1guzE2acrFecbnzlpWTrovdQ7PD3T9nK38A4Tm336f+g1QIbtPsdHz+KcXALB3Dj X-Gm-Message-State: AOJu0Yx+ifWG+HXc7oAJToEdt1TU2weTrZUETPCVT/jE+YKr6UD8lw0Q V8v1eUfb5sCKA8HU5IY0PlOf+d021BGtSCydYLSIJvy8tsfVrVyK X-Received: by 2002:ac2:5f49:0:b0:513:37a1:ae60 with SMTP id 9-20020ac25f49000000b0051337a1ae60mr749606lfz.34.1709631484056; Tue, 05 Mar 2024 01:38:04 -0800 (PST) Received: from pc636 (host-90-235-1-20.mobileonline.telia.com. [90.235.1.20]) by smtp.gmail.com with ESMTPSA id d30-20020a19385e000000b00513318e99a9sm1744744lfj.165.2024.03.05.01.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 01:38:03 -0800 (PST) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Tue, 5 Mar 2024 10:38:00 +0100 To: Frederic Weisbecker Cc: Uladzislau Rezki , "Paul E . McKenney" , RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Oleksiy Avramchenko Subject: Re: [PATCH v5 2/4] rcu: Reduce synchronize_rcu() latency Message-ID: References: <20240220183115.74124-1-urezki@gmail.com> <20240220183115.74124-3-urezki@gmail.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Mar 04, 2024 at 11:56:19PM +0100, Frederic Weisbecker wrote: > Le Mon, Mar 04, 2024 at 05:23:13PM +0100, Uladzislau Rezki a écrit : > > On Mon, Mar 04, 2024 at 12:55:47PM +0100, Frederic Weisbecker wrote: > > The easiest way is to drop the patch. To address it we can go with: > > > > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > index 31f3a61f9c38..9aa2cd46583e 100644 > > --- a/kernel/rcu/tree.c > > +++ b/kernel/rcu/tree.c > > @@ -1661,16 +1661,8 @@ static void rcu_sr_normal_gp_cleanup(void) > > * wait-head is released if last. The worker is not kicked. > > */ > > llist_for_each_safe(rcu, next, wait_tail->next) { > > - if (rcu_sr_is_wait_head(rcu)) { > > - if (!rcu->next) { > > - rcu_sr_put_wait_head(rcu); > > - wait_tail->next = NULL; > > - } else { > > - wait_tail->next = rcu; > > - } > > - > > + if (rcu_sr_is_wait_head(rcu)) > > break; > > - } > > > > rcu_sr_normal_complete(rcu); > > // It can be last, update a next on this step. > > > > > > i.e. the process of users from GP is still there. The work is triggered > > to perform a final complete(if there are users) + releasing wait-heads > > so we do not race anymore. > > It's worth mentioning that this doesn't avoid scheduling the workqueue. > Except perhaps for the very first time rcu_sr_normal_gp_cleanup() is called, > the workqueue will always have to be scheduled at least in order to release the > wait_tail of the previous rcu_sr_normal_gp_cleanup() call. > No, it does not avoid for sure :) I will add more explanation. > But indeed you keep the optimization that performs the completions themselves > synchronously from the GP kthread if there aren't too many of them (which > probably is the case most of the time). > > > I am OK with both cases. Dropping the patch will make it more simple > > for sure. > > I am ok with both cases as well :-) > > You choose. But note that the time spent doing the completions from the GP > kthread may come at the expense of delaying the start of the next grace period, > on which further synchronous RCU calls may in turn depend on... > That is a true point. Therefore we do it with a fixed number which should not influence on a GP. -- Uladzislau Rezki