Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1027597pxb; Wed, 13 Apr 2022 18:45:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/jQ0/wtnWG6Kj/NyxHfVi8cs4GniFwWu+YCEKZioXLBiEp50b2SviJxkSgfjoL1bmKW6y X-Received: by 2002:a63:2bc1:0:b0:398:5eec:6e77 with SMTP id r184-20020a632bc1000000b003985eec6e77mr376047pgr.83.1649900701439; Wed, 13 Apr 2022 18:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649900701; cv=none; d=google.com; s=arc-20160816; b=Wge/5QtaHZUbOtRJkoKdPa/2ldYTST5Grg+yeJzLrrSlc18ZnUA8tzR6NE1rKIi3LE Id7lQ/KeWqnDzR4bR9OctEsZDoEYkprrxreLRKmIhz5qZaiNDt6N7FJihncG7x7LfZ7G hZObw0YuaBBujYNgfH6zUham7ymc70622yCowiudl9D4uUAsFPM7YKJC46NAPuowu1QU ATcZ9mvWR/gyuDjhhx/XJU8sGCyU9tftl3w2lxSxC3DVEII4FROuXg19oePAR0JvPpRo UJF85RRISyluTg3ZQb8sX6+wHB7tvj8XjOZChT7Q6P/5Sldy7aMBoMZM4B+W/1FGkQg8 ZJbw== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=kw3Qj1WV6vgUmUzd+P79m8uZa8UqkKviwwhAgsZu4m8=; b=FQsB7zHJIpj+XAtOScfrBrsV+M2ynwuq/K4cHr4M+yyngDpKxIP7NTK8jGqcLT+vgi Vj+20k059H6QS9L3rgsvMESeD5QyYtvgs/c6CbXZ1B9ElIBE82T6ekeZ+drglWkBKyOq ryfmufqN3pc5wcYXPdTj4YZIheMwWWTq3vD8gOKtptffH+fowvJfxcbI/4VbxZqae7BF 18sb+8mrnN1b5z0l4GT4hW7kIK3NpOKDd/tDIg2tNb7aVcOb5e8MfeO1Ddln78tE7hIy wReGtRC/iEac54axaZiBgOOnpXHqV7i+XmywtAaIA3FBmoXbMC57rAEeyBq9mgjQCsGe jvhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LxQQ7XnA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a6546cd000000b003816043eeffsi7105924pgr.244.2022.04.13.18.44.46; Wed, 13 Apr 2022 18:45:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LxQQ7XnA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234321AbiDMSJh (ORCPT + 99 others); Wed, 13 Apr 2022 14:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbiDMSJf (ORCPT ); Wed, 13 Apr 2022 14:09:35 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B3D4C79C for ; Wed, 13 Apr 2022 11:07:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CCD5CCE2262 for ; Wed, 13 Apr 2022 18:07:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46931C385A4; Wed, 13 Apr 2022 18:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649873230; bh=tSvzwTIx8wtDLjqMEI1/ahaBRJn4S+5/ueHjYbPB5kI=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=LxQQ7XnAutc4QNuCM66b8mGUUDF1/aacifxp4chO4PnkquHdWNdul6Hw13veN/m18 9+kM01YboCq9KlquO75ka3l1GKmkEg0KnV0fl7YwAOqW1+1cQd6sO7WOvzJt2N9pHl mcEol1s+OEpThG1zbGpLgzXxcEnKK0fx2fwFztq8LvhW20S+qx5GXIhr0rYXsvDL9K 2IcKeZxc4ydIlF0sh5T0CEf3/x7hkGW3PcNB3ai4ItUxYr1eLvaez9du+Cpbpo2iUv omdD+5uhQNoSXi967FV9tUrkh5AxgNCBz7Ta0xgk6Z4jUayIrctcVjhUUq86TGn5FJ FzDPuh4QHByrw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DC91F5C013A; Wed, 13 Apr 2022 11:07:09 -0700 (PDT) Date: Wed, 13 Apr 2022 11:07:09 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: Hillf Danton , Kalesh Singh , LKML Subject: Re: [PATCH v2] EXP rcu: Move expedited grace period (GP) work to RT kthread_worker Message-ID: <20220413180709.GN4285@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220408143444.GC4285@paulmck-ThinkPad-P17-Gen-1> <20220408153447.GE4285@paulmck-ThinkPad-P17-Gen-1> <20220408173908.GJ4285@paulmck-ThinkPad-P17-Gen-1> <20220409071740.6024-1-hdanton@sina.com> <20220413113711.1263-1-hdanton@sina.com> <20220413140729.GL4285@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 13, 2022 at 01:21:20PM -0400, Joel Fernandes wrote: > Hi Paul, > > > On Wed, Apr 13, 2022 at 8:07 AM Paul E. McKenney wrote: > > > > On Wed, Apr 13, 2022 at 07:37:11PM +0800, Hillf Danton wrote: > > > On Sat, 9 Apr 2022 08:56:12 -0700 Paul E. McKenney wrote: > > > > On Sat, Apr 09, 2022 at 03:17:40PM +0800, Hillf Danton wrote: > > > > > On Fri, 8 Apr 2022 10:53:53 -0700 Kalesh Singh wrote > > > > > > Thanks for the discussion everyone. > > > > > > > > > > > > We didn't fully switch to kthread workers to avoid changing the > > > > > > behavior for users that dont need this low latency exp GPs. Another > > > > > > (and perhaps more important) reason is because kthread_worker offers > > > > > > reduced concurrency than workqueues which Pual reported can pose > > > > > > issues on systems with a large number of CPUs. > > > > > > > > > > A second ... what issues were reported wrt concurrency, given the output > > > > > of grep -nr workqueue block mm drivers. > > > > > > > > > > Feel free to post a URL link to the issues. > > > > > > > > The issues can be easily seen by inspecting kthread_queue_work() and > > > > the functions that it invokes. In contrast, normal workqueues uses > > > > per-CPU mechanisms to avoid contention, as can equally easily be seen > > > > by inspecting queue_work_on() and the functions that it invokes. > > > > > > The worker from kthread_create_worker() roughly matches unbound workqueue > > > that can get every CPU overloaded, thus the difference in implementation > > > details between kthread worker and WQ worker (either bound or unbound) can > > > be safely ignored if the kthread method works, given that prioirty is barely > > > a cure to concurrency issues. > > > > Please look again, this time taking lock contention in to account, > > keeping in mind that systems with several hundred CPUs are reasonably > > common and that systems with more than a thousand CPUs are not unheard of. > > You are talking about lock contention in the kthread_worker infra > which unbound WQ does not suffer from, right? I don't think the worker > lock contention will be an issue unless several > synchronize_rcu_expedited() calls are trying to queue work at the same > time. Did I miss something? Considering synchronize_rcu_expedited() > can block in the normal case (blocking is a pretty heavy operation > involving the scheduler and load balancers), I don't see how > contending on the worker infra locks can be an issue. If it was > call_rcu() , then I can relate to any contention since that executes > much more often. Think in terms of a system with 1536 CPUs (which IBM would be extremely happy to sell you, last I checked). This has 96 leaf rcu_node structures. Keeping that in mind, take another look at that code. And in the past there have been real systems with 256 leaf rcu_node structures. > I think the argument about too many things being RT is stronger though. Fair enough. Except that this could be dealt with by conditionally setting SCHED_FIFO. But the lock contention would remain. Thanx, Paul > Thanks, > > Joel > > > > > > > > Thanx, Paul > > > > > Hillf > > > > > > > > Please do feel free to take a look. > > > > > > > > If taking a look does not convince you, please construct some in-kernel > > > > benchmarks to test the scalability of these two mechanisms. Please note > > > > that some care will be required to make sure that you are doing a valid > > > > apples-to-apples comparison. > > > > > > > > Thanx, Paul > > > >