Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp81716rdb; Wed, 1 Nov 2023 18:06:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGM/HtjNHTocwOlIZ7OMjWzc4jLVmRJ2iHxuAr3J5x2FsAVjf86pDu3Bz5TW8aZybhO/cxX X-Received: by 2002:a17:903:434d:b0:1cc:3f6b:a4b6 with SMTP id lo13-20020a170903434d00b001cc3f6ba4b6mr10422198plb.56.1698887168588; Wed, 01 Nov 2023 18:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698887168; cv=none; d=google.com; s=arc-20160816; b=NAjGnPEsNMMZG/1W8Ml19SYcQld2IVqTV3Q8kEZu7o1auLuccb1HdwEc4DrY4qvT+F CZaVPXo2etI8ETl/480NI97eqsYa6K5r4u6+g0T2TNJEjhr/k+6KKOC9ROCqDQ2x2S/y dftMM0/eFnPlNudkMLPoJYpW2YVHupuf1nYcMONAhyz3j2K4BTFY1MJk02/HxWIzrTBm Z9ddjj2iKM21i3wFjQrtjtlVtmXdKa59DZU8DQ9wjJ2bKk3piiAG5REmX6a/5FhinQRB RVR+qeED2JXQh+irkH6knvWQo7Ocit2HVgfPn34GfEfro7/59CR6vCvUjjgRXNvogRdt Ruug== 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:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=Y3Pfx+C9lqoY1P4YDWqNHdNTiZWMwJmMu4H3k+fMFlw=; fh=OhvOZkbywus2BuaN1W4Ttr+BezEYDpmJB0/IcViqez8=; b=aNKY7JAN1K5MyIJCQ70qbs1Zy21xSauY2HJc4y48KdpEDtEqGWi60F1eVgSHhFbjcJ 5765StQq0FaXRJe/hUga6GDvkhWdQl0d/eH4LRa4eRrjb6zVaU/bD8jYReoUwEUOmZnu ZW0GdQtabp8z7ncly/KQNcqyX+WOJBFWijKNX34qtFqVgAPE+VKnhBM/iUD/ZLQsfHAi TB6hSdT/E8or1fvcFM2CHcela+xy8l9PvRYGR0iSHmeTxpgLIsNLmWlauC8qNPa03gFl Q/mPcKdBzaKBvRRSfYMjYYsOD+3d9z1d07AZzuYrE0txYx+v0OsAedqY3IEQea1Hi1pZ Iopw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U+TDjwIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id o14-20020a170902d4ce00b001b80ecdcb88si4209171plg.473.2023.11.01.18.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 18:06:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U+TDjwIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4054780C6EAE; Wed, 1 Nov 2023 18:06:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234819AbjKBBFz (ORCPT + 99 others); Wed, 1 Nov 2023 21:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjKBBFy (ORCPT ); Wed, 1 Nov 2023 21:05:54 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 220D4FD; Wed, 1 Nov 2023 18:05:51 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-67089696545so2659146d6.0; Wed, 01 Nov 2023 18:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698887150; x=1699491950; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=Y3Pfx+C9lqoY1P4YDWqNHdNTiZWMwJmMu4H3k+fMFlw=; b=U+TDjwIiDrGPElxmQhbvnE1e3E7aOiY53eQsVzDRdzEmvEDJ+PBxkEdo+C9oYDnWbX 8R5ItVpGvpBFd8c7GOYLZq6O+Y1oqoTG6AYURtDUy5R+szRGArfsnhQo/VqfbisljrYd Kr+iXwTSl5j+SDjK7iTPIU1NotzEIZ4AsBjhh63Jsip+PzV7lksXvsqnxZ3dfY2NIluZ pBeDQTyWHQNMUnqURvnuEoVMlWDIzgaA17iV0NkkcvSYI7T+PZ1V4YmxQflOL+clfFo5 cWuR+oBiZbYo16yl0JvhogjZz11gDeuE8OwMNYLSJsSTHy+OqkXOxupynelLpQqc8Rem 2vKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698887150; x=1699491950; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y3Pfx+C9lqoY1P4YDWqNHdNTiZWMwJmMu4H3k+fMFlw=; b=fNJRMfPcbwbfXW+wA3FcYJSaV4XkZE7qfwoVW3kg6YCi/yuDFEPdqBG2HssE8YsMo9 hbFd7AcQeVVDbjp1KaFW+bUw0/jGi7JVEa6XcNvV0680J6qCEzOgE9lu/fKPPOIXUNw1 0r80OdsalhFqP9B9GMlpPYAY+Xw93Pa8+WVWCnto6bbxt7SK2FfXnBdCgqOE530ya7Z5 d3ZTIJttxreAcY8lKb4ilRufLCzrexf+sz9TKnzOTquVpVD9/EMVDP/k1D/fwuUylk+v ori3jrT6cmVw/QrNJnvZzd31M/cm7EfOj9Cd5+70vScJbySWOiR1gZT+WuDdIbiuTYGH ELLw== X-Gm-Message-State: AOJu0Yy4nETQ+8f/Fc7nuyYlxKzCotDpn8zB4s/Udz7RvLrNqGPgiaIi uIVpz97BlJjPYhYSNy7HySx+YnliTko= X-Received: by 2002:a05:6214:f24:b0:66d:4680:6dc5 with SMTP id iw4-20020a0562140f2400b0066d46806dc5mr22748055qvb.50.1698887149690; Wed, 01 Nov 2023 18:05:49 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id i5-20020ad44ba5000000b0065b22afe53csm1961843qvw.94.2023.11.01.18.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 18:05:48 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id AC60827C005A; Wed, 1 Nov 2023 21:05:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 01 Nov 2023 21:05:47 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddthedgvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehudfgudffffetuedtvdehueevledvhfelleeivedtgeeuhfegueeviedu ffeivdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Nov 2023 21:05:45 -0400 (EDT) Date: Wed, 1 Nov 2023 18:04:40 -0700 From: Boqun Feng To: Uladzislau Rezki Cc: "Paul E . McKenney" , RCU , Neeraj upadhyay , Hillf Danton , Joel Fernandes , LKML , Oleksiy Avramchenko , Frederic Weisbecker Subject: Re: [PATCH 1/3] rcu: Reduce synchronize_rcu() waiting time Message-ID: References: <20231025140915.590390-1-urezki@gmail.com> <20231025140915.590390-2-urezki@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 01 Nov 2023 18:06:05 -0700 (PDT) On Wed, Nov 01, 2023 at 04:35:05PM +0100, Uladzislau Rezki wrote: [...] > > Basically it does not work, because you do not fix the mixing "issue". > > I have been working on it and we agreed to separate it. Because it is > > just makes sense. The reason and the problem i see, i described in the > > commit message of v2. As I understand it, your point is "if we want synchronize_rcu() faster in all the cases, then a separate list makes a lot of sense since it won't be affected by different configs and etc.", right? If so, then understood. I don't have any problem on that your patch does a good work on making synchronize_rcu() faster, and actually I don't think my proposal necessarily blocks your patch. However, I wonder: why synchronize_rcu() is more special than other call_rcu_hurry() cases? Sure, synchronize_rcu() means blocking and unblocking ealier is always desirable, but call_rcu_hurry() could also queue a callback that wake up other thread, right? By making synchronize_rcu() faster, do we end up making other call_rcu_hurry() slow? So in my proposal, as you can see, I tried to be fair among all call_rcu_hurry() users, and hope that's a better solution from the whole kernel viewpoint. Also another fear I have is the following story: (Let say your improvement gets merged. And 6 months later) Someone shows up and say "hi, the synchronize_rcu() latency reduce work is great, but we have 1024 CPUs, so the single list in sr_normal_state becomes a bottleneck, synchronize_rcu() on some CPUs gets delayed by other CPU's synchronize_rcu(), can we make the list percpu?" (And 6 months later) Someone shows up and say "hi, the percpu list for low latency synchronize_rcu() is great, however, we want to save some CPU power by putting CPUs into groups and naming one leader of each group to handle synchronize_rcu() wakeups for the whole group, let's use kconfig CONFIG_RCU_NOSR_CPU to control that feature" Well, it's a story, so it may not happen, but I don't think the possiblity of totally re-inventing RCU callback lists and NOCB is 0 ;-) Anyway, I should stop being annoying here, I will use your test steps to check my idea, and will let you know! > > > > > > > > Do you have a benchmark I can try out to see if my diff can achieve the > > > similar result? Thanks! > > > > > There is no a good benchmark. But you can write it for sure. I tested > > three scenarios: > > > > - Run a camera app on our Android devices. Measuring app launch in > > milliseconds; > > - Doing synchronize_rcu() and kfree(ptr) simultaneously by 10K/etc > > workers. It is important test case because we have a fallback to > > this scenario for our kvfree_rcu_mightslepp() API. > > - I had a look at time delta of loading 100 kernel modules. > > > > That were my main test cases. > > > I will provide the patches and test steps, so you can try on. > Tomorrow i will send it! > Thanks! Regards, Boqun > -- > Uladzislau Rezki