Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3815298pxb; Mon, 4 Oct 2021 10:11:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw0hjv9zdjkOX7r5UEJ71vAOsAngmMA0h5HNxRwKeTDYJaMxKc2/TJpVepRK6rb+v4V83N X-Received: by 2002:a63:b20c:: with SMTP id x12mr11945486pge.10.1633367459931; Mon, 04 Oct 2021 10:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633367459; cv=none; d=google.com; s=arc-20160816; b=RINJXrkwUPjRW4jPxUFkG8LkzHBnFQvl0XRm0PSCvaPZmDYGV80HqMVEoYiZ0gwrlW 6WqYbKkaJKNLzq5TdDXNPmCZ/YGY3o7nppphEnXlpkxkvYhRxnRz2PIhYPzEaQOOjxoc sB2N9hXz5ct32Zg2fgOusPvW78kvO7blgGTQyCsaJP+ZDtThHkQDW7SfHFFNm7klEtu/ yJP9dOVVPaW4efgu5mCfJYe8dcSlUi91pajxyYHATxAIQi2e7F+f1q7KxXYGYwwJcRLH EdTQQQC0RpQOl0zyhEPmZZNjgpb/p/xZeItKCfrBEiLELntdUuvBe68EQC1JSrD2/3dS BJSg== 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; bh=AK7RGi9m2vK00quX6Lyx7c/3iLdLlT/pt4YpTGmp5Ns=; b=uqTn1GF/Z6tPPA9M9JL4g9/h5+BBVTLHiTbT1BkJ6+y5JffEHpqzRSgbzjnIyvi80V D0bh2xJiJFm17IGkBvENy3uMFV8U4mOhpFkKtvhmgIr58VH+BXQ8xR5y6hVbTYPsgeTp z+o/T7gDBh8+2UqBzcvEszOz5+7u6nX0msEmDOkJloo4CZgQ0JEbN3r/Zc+jHI4uSejn XSr/GQYU7wV5lJgGSfzHx5AwGB+pvDPyU0iBq8As3jXezc5cd8IVDDh3UYLW8nesKojj 6WFDs2lyQXrvmrIItKRxZCBWRko2y7b3BoRD6NaATEIojFMqylBk1JqQoab9FS98vBFa 8tUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si18315945pll.315.2021.10.04.10.10.45; Mon, 04 Oct 2021 10:10:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233179AbhJDOMA (ORCPT + 99 others); Mon, 4 Oct 2021 10:12:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:43520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233159AbhJDOL7 (ORCPT ); Mon, 4 Oct 2021 10:11:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C23D161216; Mon, 4 Oct 2021 14:10:10 +0000 (UTC) Subject: [PATCH 3/4] SUNRPC: Per-rpc_clnt task PIDs From: Chuck Lever To: trondmy@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Date: Mon, 04 Oct 2021 10:10:10 -0400 Message-ID: <163335661005.1225.6870220946398100360.stgit@morisot.1015granger.net> In-Reply-To: <163335628674.1225.6965764965914263799.stgit@morisot.1015granger.net> References: <163335628674.1225.6965764965914263799.stgit@morisot.1015granger.net> User-Agent: StGit/1.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The current range of RPC task PIDs is 0..65535. That's not adequate for distinguishing tasks across multiple rpc_clnts running high throughput workloads. To help relieve this situation and to reduce the bottleneck of having a single atomic for assigning all RPC task PIDs, assign task PIDs per rpc_clnt. Signed-off-by: Chuck Lever --- include/linux/sunrpc/clnt.h | 1 + net/sunrpc/sched.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index bd22f14c4b19..d5860a000806 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -40,6 +40,7 @@ struct rpc_clnt { int cl_clid; /* client id */ struct list_head cl_clients; /* Global list of clients */ struct list_head cl_tasks; /* List of tasks */ + atomic_t cl_pid; /* task PID counter */ spinlock_t cl_lock; /* spinlock */ struct rpc_xprt __rcu * cl_xprt; /* transport */ const struct rpc_procinfo *cl_procinfo; /* procedure info */ diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index c045f63d11fa..b3402aeb8f30 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -277,9 +277,17 @@ static int rpc_wait_bit_killable(struct wait_bit_key *key, int mode) #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS) static void rpc_task_set_debuginfo(struct rpc_task *task) { - static atomic_t rpc_pid; + struct rpc_clnt *clnt = task->tk_client; - task->tk_pid = atomic_inc_return(&rpc_pid); + /* Might be a task carrying a reverse-direction operation */ + if (!clnt) { + static atomic_t rpc_pid; + + task->tk_pid = atomic_inc_return(&rpc_pid); + return; + } + + task->tk_pid = atomic_inc_return(&clnt->cl_pid); } #else static inline void rpc_task_set_debuginfo(struct rpc_task *task)