Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8848657rwp; Wed, 19 Jul 2023 16:50:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5EuR5vEjak5I/YWUXTZ0bFcuc7a7LU8xwH/8C9zDktPY2AWOPFH7eX5tgX4/tFfVtUFWk X-Received: by 2002:a17:906:14:b0:99b:4210:cc75 with SMTP id 20-20020a170906001400b0099b4210cc75mr2363411eja.40.1689810631330; Wed, 19 Jul 2023 16:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689810631; cv=none; d=google.com; s=arc-20160816; b=I813D6FS95LYluc6gQtcN9bl4fIgYED27HK22EVvCd1wFEJDse46H3wjMnOjAJBjv3 3gtygfYmEhx0dlVyhgUps84GhErrrzIf8ICoEfIJCRqLmplI0R29VsCLvky6eXbFaJsh 9qvjEMQm7XEuyztk7ORTxIxSjrmmItjUM4lyhejg9N6D/2VRlPUxE8uGeVpxn2kUA9gT J2iNLQyfCYz1JqiivEHEr+S+ZGa6Zm6De2jU88yNTjkAYT4TG1u0HTg7KIKoIQoRwg2B w8zOStCTNbWJ91khk54/NBu7AwyzvMw9LC83ZWQ6RwEVPpNRBFO/PxixTbhBt6AwLWW/ nptA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=y/OWWRwPvO0YlLnKu6AOus6tzg3z5Bp2WSJOuutaJSc=; fh=Yjgs+yt7oflifVRM1bK11aB9HF4NZ0yPUmbEuCnbH6w=; b=S9FzYgvCxyaWGw+E+hoNrGfQ9NMD0K13HFtZvYzwgAGzN9bQ0lCPmp7VjVxfVjHA28 umJrRumqV4oArUPFbJ/nQqtgVrP9cm7PPPdroxt2u0V+MEiVlrnPDzM2D/OGAMRzdumC M8YFyvLYhkczx43T3YPnwAy+tt1B+83jCzCzt4ZJ+61BMCSAbwcuFLhPE8TlRhLYu+sa VBj8NV0ZK98ow2lwhgCSnJuFjvTzgP0gisOjEE7Ltmk0mcN7B4q0tDl8fBBQKKvlzULd APuhLyY9l0NCPkRT/C3+nVI7JDMYptVEXZMGlxxG8/ZI+I7514S3sU5ABdYEsl+1HMt1 n1IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mnv32iXx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gz6-20020a170906f2c600b00987d26a0998si3604903ejb.455.2023.07.19.16.49.58; Wed, 19 Jul 2023 16:50:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@suse.de header.s=susede2_rsa header.b=mnv32iXx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbjGSX1b (ORCPT + 99 others); Wed, 19 Jul 2023 19:27:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjGSX1a (ORCPT ); Wed, 19 Jul 2023 19:27:30 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B800F9D for ; Wed, 19 Jul 2023 16:27:29 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 78B7D20258; Wed, 19 Jul 2023 23:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689809248; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y/OWWRwPvO0YlLnKu6AOus6tzg3z5Bp2WSJOuutaJSc=; b=mnv32iXxFX4fWhQ5HlitCRSudqlMEKpRZ0qi0gGY256RnCD+RgnRqSH9aP0AxDv43cw0hP QTYyyK/vvcYUtYzehRYvK80Zxe0NAXfUB0Xz/mmsTmw+DrHxnA7O02tzxmXI5WW8fh6vVx VQ+a2rudhzl3Aj5J1aChMlyrgynaiVY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689809248; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y/OWWRwPvO0YlLnKu6AOus6tzg3z5Bp2WSJOuutaJSc=; b=kYANUlmA26BhVunKROeGttW1rrV5XtahmtVtNYTKv3xDIF26q30C0gvTCPNmS8I37QXdXR TdwffzvRCoXEMaCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5043813460; Wed, 19 Jul 2023 23:27:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hkZoAV5xuGQxQAAAMHmgww (envelope-from ); Wed, 19 Jul 2023 23:27:26 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "Chuck Lever III" Cc: "Chuck Lever" , "Linux NFS Mailing List" , "lorenzo@kernel.org" , "Jeff Layton" , "david@fromorbit.com" Subject: Re: [PATCH v3 5/9] SUNRPC: Count pool threads that were awoken but found no work to do In-reply-to: <3FF89A33-6C7C-4BC2-9973-A20E46A8A339@oracle.com> References: <168900729243.7514.15141312295052254929.stgit@manet.1015granger.net>, <168900734678.7514.887270657845753276.stgit@manet.1015granger.net>, <168902815363.8939.4838920400288577480@noble.neil.brown.name>, , <168972716973.11078.4474704978173049217@noble.neil.brown.name>, <3FF89A33-6C7C-4BC2-9973-A20E46A8A339@oracle.com> Date: Thu, 20 Jul 2023 09:27:23 +1000 Message-id: <168980924309.11078.8450297121939615798@noble.neil.brown.name> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-nfs@vger.kernel.org On Wed, 19 Jul 2023, Chuck Lever III wrote: > > > On Jul 18, 2023, at 8:39 PM, NeilBrown wrote: > > > > On Tue, 11 Jul 2023, Chuck Lever III wrote: > >> > >>> On Jul 10, 2023, at 6:29 PM, NeilBrown wrote: > >>> > >>> On Tue, 11 Jul 2023, Chuck Lever wrote: > >>>> From: Chuck Lever > >>>> > >>>> Measure a source of thread scheduling inefficiency -- count threads > >>>> that were awoken but found that the transport queue had already been > >>>> emptied. > >>>> > >>>> An empty transport queue is possible when threads that run between > >>>> the wake_up_process() call and the woken thread returning from the > >>>> scheduler have pulled all remaining work off the transport queue > >>>> using the first svc_xprt_dequeue() in svc_get_next_xprt(). > >>> > >>> I'm in two minds about this. The data being gathered here is > >>> potentially useful > >> > >> It's actually pretty shocking: I've measured more than > >> 15% of thread wake-ups find no work to do. > > > > I'm now wondering if that is a reliable statistic. > > > > This counter as implemented doesn't count "pool threads that were awoken > > but found no work to do". Rather, it counts "pool threads that found no > > work to do, either after having been awoken, or having just completed > > some other request". > > In the current code, the only way to get to "return -EAGAIN;" is if the > thread calls schedule_timeout() (ie, it actually sleeps), then the > svc_rqst was specifically selected and awoken, and the schedule_timeout() > did not time out. > > I don't see a problem. > Yeah - I don't either any more. Sorry for the noise. > > > And it doesn't even really count that is it doesn't notice that lockd > > "retry blocked" work (or the NFSv4.1 callback work, but we don't count > > that at all I think). > > > > Maybe we should only update the count if we had actually been woken up > > recently. > > So this one can be dropped for now since it's currently of value only > for working on the scheduler changes. If the thread scheduler were to > change such that a work item was actually assigned to a thread before > it is awoken (a la, a work queue model) then this counter would be > truly meaningless. I think we can wait for a bit. > We used to assign a workitem to a thread before it was woken. I find that model to be aesthetically pleasing. Trond changed that in Commit: 22700f3c6df5 ("SUNRPC: Improve ordering of transport processing") claiming that the wake-up time for a sleeping thread could result in poorer throughput. No data given but I find the reasoning quite credible. Thanks, NeilBrown > > -- > Chuck Lever > > >