Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26899191rwd; Mon, 3 Jul 2023 17:13:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7as5m/BqMEHV2vDBhR4bleE/WUObV22/AClT79w/yrxpBsIqFNv4q0MhE0rYdproCtS5H6 X-Received: by 2002:a05:6808:7c9:b0:39c:717c:f4e3 with SMTP id f9-20020a05680807c900b0039c717cf4e3mr10208382oij.27.1688429602865; Mon, 03 Jul 2023 17:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688429602; cv=none; d=google.com; s=arc-20160816; b=L6lwpMEu+Nc2T8G2dwbh9G8+0/pqEkeQlxk2BbAXCcmX833AhQG+bgYeau90YxqTGN HYY5uScs2lf+O3ZeRPiuPVgM/CqGuAerz/ANeFoUCjQTQsxYmfltT0PSTTY5/Sb/TtPV EngmRgRKVM5m2j+3CQpX2TmwtJxt+qPtP7XLFOCR9HkZMsv0ZxzrruU8toMCyPXRa+A/ 1LRH5Jd+WXy1wL3U6CVaqIGLa/EVVgNXkyK8l096HH0w0ZEOIGnV+2ARrj3enk7VsaQI RCajkuCxNH6k7YRP0A+OO8dIgy3zvwkYnwiq/jurn0jXY4HjUfxtxKunlbplf1j0NYL7 feuA== 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:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=AoTMkvsF22R6c90QHjzlB/1fRInQUaRnjQFYtRPlX08=; fh=An0MVVPXmcTJNFrRZLpT7ZfNQmt2AI9hBye10HEz75U=; b=mrgBIklaGa6P1R+Qz7phVoQqT+hZBs385++Zn5/Ule92Qko9NW89xkKINkOGb5VoOf rjnSEawK9l0ePw2cZlAHTN/viGrcqMtL5frYWW09/8UnI2w/bmaOujqg7Sxr+6TEWv0/ lG4HIwwd8PPZCBjjHGxbRFFRhr9QtCb/kEsCJkngCx1RvA+QSXFV9slU/gPqFGp3ds/3 fchZhRIO0CyTf1hJHr1zU0/DXSyVQqx+lUXi2X5K2UO0q1VxY2WNDYpD4KFLlgPRC0ya ztHX+niR42dpmHXvUMCNtLykdE2qGqtRCB+S4HQ/L6RZkqKGyG4xSxG8rcivAJlNAhSw NogQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cr5RlX82; 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 u62-20020a638541000000b0054ff0049d08si19060808pgd.404.2023.07.03.17.13.10; Mon, 03 Jul 2023 17:13:22 -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=Cr5RlX82; 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 S229844AbjGDAH7 (ORCPT + 99 others); Mon, 3 Jul 2023 20:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjGDAH7 (ORCPT ); Mon, 3 Jul 2023 20:07:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EFFF189 for ; Mon, 3 Jul 2023 17:07:58 -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)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1C6C6101C for ; Tue, 4 Jul 2023 00:07:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF11CC433C7; Tue, 4 Jul 2023 00:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688429277; bh=Pd5LJz7RnhNldHfozSUpV8hFuK5ZHPY0lcE/FPM6KwU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Cr5RlX82MJv24GfKUU4NjL0fCPlTKdByPRpbD/dgHa5m9WwIde+Axb3ochDD3CLqZ Ph7fqftp9NKL5eyzzmbgw+YpTR07wzlkMUSq1hDcEQHdR0Cyvp45JZZ7yojuFE5l8r MGRelWobKgASB/oP96eM3TxRrfILV2/pYRRzQ6SUzSFWcF+wK0zWdNEjkmOMCrzJa+ 6AferQOoAMQzkV8d2wUYSWLYSdeYrGFZEM3O/oj9yZIYBFz3d1QkFeWB3JlMnV95rv Sv3jdPU89J/dc9p5VnKSSHn0QOJshnWxm7aXRnxtNesGPNBxPW65pOm3FECW8plfHr Wc7hFUwkTdfTA== Subject: [PATCH v2 4/9] SUNRPC: Count ingress RPC messages per svc_pool 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: Mon, 03 Jul 2023 20:07:55 -0400 Message-ID: <168842927591.139194.16920372497489479670.stgit@manet.1015granger.net> In-Reply-To: <168842897573.139194.15893960758088950748.stgit@manet.1015granger.net> References: <168842897573.139194.15893960758088950748.stgit@manet.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=-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-nfs@vger.kernel.org From: Chuck Lever To get a sense of the average number of transport enqueue operations needed to process an incoming RPC message, re-use the "packets" pool stat. Track the number of complete RPC messages processed by each thread pool. Signed-off-by: Chuck Lever --- include/linux/sunrpc/svc.h | 1 + net/sunrpc/svc.c | 2 ++ net/sunrpc/svc_xprt.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index fbfe6ea737c8..74ea13270679 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -38,6 +38,7 @@ struct svc_pool { struct list_head sp_all_threads; /* all server threads */ /* statistics on pool operation */ + struct percpu_counter sp_messages_arrived; struct percpu_counter sp_sockets_queued; struct percpu_counter sp_threads_woken; struct percpu_counter sp_threads_timedout; diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 04151e22ec44..ccc7ff3142dd 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -513,6 +513,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, INIT_LIST_HEAD(&pool->sp_all_threads); spin_lock_init(&pool->sp_lock); + percpu_counter_init(&pool->sp_messages_arrived, 0, GFP_KERNEL); percpu_counter_init(&pool->sp_sockets_queued, 0, GFP_KERNEL); percpu_counter_init(&pool->sp_threads_woken, 0, GFP_KERNEL); percpu_counter_init(&pool->sp_threads_timedout, 0, GFP_KERNEL); @@ -589,6 +590,7 @@ svc_destroy(struct kref *ref) for (i = 0; i < serv->sv_nrpools; i++) { struct svc_pool *pool = &serv->sv_pools[i]; + percpu_counter_destroy(&pool->sp_messages_arrived); percpu_counter_destroy(&pool->sp_sockets_queued); percpu_counter_destroy(&pool->sp_threads_woken); percpu_counter_destroy(&pool->sp_threads_timedout); diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 7ee095d03996..ecbccf0d89b9 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -897,6 +897,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) if (serv->sv_stats) serv->sv_stats->netcnt++; + percpu_counter_inc(&rqstp->rq_pool->sp_messages_arrived); rqstp->rq_stime = ktime_get(); return len; out_release: @@ -1446,7 +1447,7 @@ static int svc_pool_stats_show(struct seq_file *m, void *p) seq_printf(m, "%u %llu %llu %llu %llu %llu\n", pool->sp_id, - percpu_counter_sum_positive(&pool->sp_sockets_queued), + percpu_counter_sum_positive(&pool->sp_messages_arrived), percpu_counter_sum_positive(&pool->sp_sockets_queued), percpu_counter_sum_positive(&pool->sp_threads_woken), percpu_counter_sum_positive(&pool->sp_threads_timedout),