Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21153053rwd; Thu, 29 Jun 2023 11:42:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFEW1iN9xgtGq1zK7EQtjCA0sGEe2OnaklItC+OR8DEl3DUjv9ELl4nRyYhlGiSZwn/wUrd X-Received: by 2002:a17:90a:6485:b0:262:fa78:ecec with SMTP id h5-20020a17090a648500b00262fa78ececmr274072pjj.15.1688064165469; Thu, 29 Jun 2023 11:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688064165; cv=none; d=google.com; s=arc-20160816; b=bfs59n4nhXhm1cCprRMrqHydwaByHzmnL1+kaBycGQHPzN+9vZc6lLmyrdr9cHcqk2 wNIC/vI5Z1MBhHOsV6CpGz5YAhSkG4fBGq9VYyB1hY4vTgiWCiZqeonR4UPTHQ13vS3r rJJywnpXCbKqFMn6skoxNYiaSvxxbu+ae0OX0V4lQ/JvMPp6sXRvuI6JG3YituDYy7aE r1quzKngLJGLHMLhYowcqA85qJH5dOiQ4Z6L7ljSI1tlKmrZpsMRfkkqbgjpVCr5ql6V wfbATVgYPFbJQGyCo2deDSz0yIJmMxIz9IY71o7bZaqB5/dVmFU3hRlYPrzduTg/0oZf xv3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=jkkCLC8kVNOZtfEH5mhb3gV2K7H9Nj7n9cPltqJlD4E=; fh=An0MVVPXmcTJNFrRZLpT7ZfNQmt2AI9hBye10HEz75U=; b=T/AQcosw3MzNa/OUsbQPiWbiPz8Isrg9Ao3JefhdUbqBJpXZ7VjB3fUwKV2vTCnkXQ b+Hlp66sTmaKsPwuMXwy71EEA18e3/3dGoKAB47rdsbFVquMjQnwbemAQlQltFkTTix6 iaLSZCOv0Z9GrTSQTpYI7+Ks6mc5hOd8Qyrfny87z7z30gKCuOfB/m6xlb+p/KUPD9EJ MPXqoUFBbKbrm2l+KLXdQsUSXBMb55f/9bzCEKi9w3NsMYKsKGtxVHb9R+8KRGeY4IFO ABLRxVaO/YBKhPWuboOdtyYPSF5LybmNsN7uzAJ0MUfP/W6vAP/68HATJxMGHkx/GUeH M09Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rApkjczu; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t62-20020a638141000000b00543d33304e6si11109961pgd.667.2023.06.29.11.42.31; Thu, 29 Jun 2023 11:42:45 -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=@kernel.org header.s=k20201202 header.b=rApkjczu; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232766AbjF2Sm3 (ORCPT + 99 others); Thu, 29 Jun 2023 14:42:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232761AbjF2Sm2 (ORCPT ); Thu, 29 Jun 2023 14:42:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52EE02681 for ; Thu, 29 Jun 2023 11:42:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA0EE615C8 for ; Thu, 29 Jun 2023 18:42:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9154C433C0; Thu, 29 Jun 2023 18:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688064145; bh=Smtwvse0G5PjHDobA8Ui2u0KyQlinxB5/J60SY9cYm0=; h=Subject:From:To:Cc:Date:From; b=rApkjczu8EDkuVeIqHfRaHF8C/0ITjaBOY2aWCqMbQn7uHAhVN2lNbv7MQ+v2mDtT ZViKvGV5U2kIdX4d1YM0DAMYsGT/6NoU//ghA5UciVv1Yt3/2SfnpIm0JTUxWUpA8E M9PU2ayHpEiafsmp0yeHn1tEXolv1z3njepAX/Y+V1ub2iZwDw1KA/YZKZ6eBZLvQ7 /PCC0y2DZmax0qFJqYtiVFcl/5DCnZWztQCI03bfsdOBAsT5NoZzkUIZ4ukORb3hX+ LnJl6Q9EzGoF8EWH8oWcwV3j/FQz8Aajr0T7UKUL8d0GIVDRL4MFrPCPylZcA98DTr fscx+iKcED29w== Subject: [PATCH RFC 0/8] RPC service thread scheduler optimizations From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever , lorenzo@kernel.org, neilb@suse.de, jlayton@redhat.com, david@fromorbit.com Date: Thu, 29 Jun 2023 14:42:23 -0400 Message-ID: <168806401782.1034990.9686296943273298604.stgit@morisot.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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-nfs@vger.kernel.org Hi - Walking a linked list to find an idle thread is not CPU cache- friendly, and in fact I've noted palpable per-request latency impacts as the number of nfsd threads on the server increases. After discussing some possible improvements with Jeff at LSF/MM, I've been experimenting with the following series. I've measured an order of magnitude latency improvement in the thread lookup time, and have managed to keep the whole thing lockless. The only thing I don't like is that allocating the idle bitmaps in advance means we've got an /a priori/ cap on the number of NFSD threads that can be created. I'd love to find a way to enable the pool idle bitmaps to expand dynamically. Suggestions welcome. Cc: Lorenzo - I'm not sure whether this work would be applied first or whether your rpc_status patch would be. If yours goes first, I can handle converting nfsd_rpc_status() to use the pool's thread xarray. --- Chuck Lever (8): SUNRPC: Deduplicate thread wake-up code SUNRPC: Report when no service thread is available. SUNRPC: Split the svc_xprt_dequeue tracepoint SUNRPC: Clean up svc_set_num_threads SUNRPC: Replace dprintk() call site in __svc_create() SUNRPC: Replace sp_threads_all with an xarray SUNRPC: Convert RQ_BUSY into a per-pool bitmap SUNRPC: Don't disable BH's when taking sp_lock fs/nfsd/nfssvc.c | 3 +- include/linux/sunrpc/svc.h | 17 ++-- include/trace/events/sunrpc.h | 160 ++++++++++++++++++++++++++++---- net/sunrpc/svc.c | 169 ++++++++++++++++++++++------------ net/sunrpc/svc_xprt.c | 103 +++++++++++---------- 5 files changed, 316 insertions(+), 136 deletions(-) -- Chuck Lever