Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp475840rdh; Thu, 26 Oct 2023 07:22:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCjsSNzMOQpv5iTq71Enpr0tLXqzzgQzLYCRij7OWuskB8+dzcudjcOZUUWT0X7cwj9Ip/ X-Received: by 2002:a25:ac07:0:b0:d9b:d0cb:db74 with SMTP id w7-20020a25ac07000000b00d9bd0cbdb74mr18907346ybi.33.1698330154916; Thu, 26 Oct 2023 07:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698330154; cv=none; d=google.com; s=arc-20160816; b=re40rZTRSTQWRlAeFPut1Ha2UJDgcQQ+lNHiblh7HaV0BgFUleukZTaRzrw1bbMFp6 p8tzlYmR5Dilby5WkzeEslS5U4JKVzFzc5apMlPJBSqtV1JzkIk9gSdGwcs5caa6jk2g FKPxKLjUuvuJ42Io4fe3k/6XDqJRn980z7Dea/Uuui65YE3jf8EB78AIR1VpeSUPesPx h5f7GGfGhJWMzD13aKfCOTH6n4JZf9RiEaPSuehCHu5kgr+s9heATCS/qblrc/uVrDWT yQsjarRx/qmGQGTCTATHTwTCTkQ4m0tDYmkz+x6I9ngjMad0JBfDP2UQbSsoCX0b6hpw f+Wg== 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:dkim-signature; bh=6bh4yfaIHTLnH9TJVxlmCTLJuj7PLW2Cl/VReWOo9Y4=; fh=x5EVJoPG6ig7lfovOxVsbUIGy7PuVoTFc209eBD3IO8=; b=bqmLU8V2a+lh49LD9iT57Z2hbR65/SQYB0TWji2R3x2UPQTGRgUbZ4dd7Izz2MTLRn 53UG/AIMQzuCHv2Blq+wcaCojfCzEdTLOGs1sscBNbAx+WAkW5nU7MYqjy6f2eLGHcLK lRTL4qUehqyPnI2eu8rpvZlbk2kyXAIK+Geg4CxUpUoid39UFXRJAZmWZT5AlyJj3GD7 1cckQy0CGYMf+G1rQGsbRgZPg6AmNUBio9znJwwyzdaNm/CAz4Pp4KVkTodC81V3IiB9 4MxSYVQ8VtBsrS0vS4xcpeYpgZBrJ5Ww9cFgVbNI+SHeqtAwLjvLEfAGDl3yNODAwWqt fiQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="CZQ/uhor"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u25-20020a25f819000000b00d9abe0659fasi15185908ybd.30.2023.10.26.07.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 07:22:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="CZQ/uhor"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 83AD1809714D; Thu, 26 Oct 2023 07:22:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345210AbjJZOWX (ORCPT + 99 others); Thu, 26 Oct 2023 10:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235036AbjJZOWW (ORCPT ); Thu, 26 Oct 2023 10:22:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0FC1128; Thu, 26 Oct 2023 07:22:20 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00D8DC433C8; Thu, 26 Oct 2023 14:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698330140; bh=ReF9zaUXu0sZ+PuTc7MtN6FAGsaQwd2XyDGFYmv5jgA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CZQ/uhorQXgghmZwn2hDEQJgZ+0zTgPiYs0ZXWlBZrv9ZDsiPKSjZgcJEtLNojSOo EuWiQaLfdN1CHLsLgzFuTN6P2vzmuhvXYrJ9cInV8WXWOBop4ozO0eBUVRxfddVkND pNSnbQkEcvy3kL6eW1aZE/nP766/oy/omOfGH/8C+UySItzI7zzjKcITccD6pPZ7jR jyUbp5k/4ueqPtiDq4Qv+1QBWUkrshoVIVv9VGn1RrrVJs70EM2/fmU2vjvbJFJvf6 cDQZxeQLoXQ9fRriebwubhiPbqCtqfvoVDF7MnILJEqPO9SEJfKHoabEuqGo5kCM1e mTP6iwhx3634g== Date: Thu, 26 Oct 2023 16:22:17 +0200 From: Frederic Weisbecker To: Uladzislau Rezki Cc: "Paul E . McKenney" , RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Oleksiy Avramchenko 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=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 26 Oct 2023 07:22:31 -0700 (PDT) On Thu, Oct 26, 2023 at 03:00:25PM +0200, Uladzislau Rezki wrote: > On Wed, Oct 25, 2023 at 05:13:27PM +0200, Frederic Weisbecker wrote: > > > + llist_for_each_safe(pos, head, head) { > > > > Two times head intended here? There should be some > > temporary storage in the middle. > > > Yes. It is intentially done. The head is updated, i.e. shifted to a next, > because we directly process users from a GP. The number is limited to 5 > all the rest is deferred. Ah ok. > > So you can have: > > > > * Queue to sr.curr is atomic fully ordered > > * Check and move from sr.curr to sr.wait is atomic fully ordered > > * Check from sr.wait can have a quick unatomic unordered > > llist_empty() check. Then extract unatomic unordered as well. > > * If too many, move atomic/ordered to sr.done. > > > > Am I missing something? > > > If too many move to done and kick the helper. The sr.wait can not > be touched until the rcu_sr_normal_gp_cleanup() is completed, i.e.: > > > GP-kthread(same and one task context): > rcu_sr_normal_gp_cleanup(); > wait for a grace period; > rcu_sr_normal_gp_cleanup(); > > > Am i missing your point? Yeah got it. My point was just that any manipulation of sr.wait can be done without atomic/ordered operations. Such as using __list_empty() and __llist_del_all(). Ah there is also the line: llist_add_batch(head, tail, &sr.wait); in rcu_sr_normal_gp_init() that can be turned into __llist_add_batch() Thanks.