Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp24286lqn; Thu, 11 Apr 2024 12:31:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXwvOKkEPDHlNpw0YAsgJoV+hSkBodZaPiQw3CjJ7MMT8EbhBpMoCzI7nxg1Yq6OHVyLgaraGCj2bUP4nnLtEox4DxFfiyG/P8GZziZXQ== X-Google-Smtp-Source: AGHT+IGCNyy7aAGol0olYgy+fkDX27ZVKPCiY2zqAwH8OfEnipHSmuRX3GxmArTDgRyg6wEhHTSE X-Received: by 2002:a17:906:abc2:b0:a52:33ed:af6e with SMTP id kq2-20020a170906abc200b00a5233edaf6emr26576ejb.71.1712863900007; Thu, 11 Apr 2024 12:31:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712863899; cv=pass; d=google.com; s=arc-20160816; b=ikkyZwpLgKhmxbFulSu8lNoL0O2OQGbnOOaOdB463GyN5Gp+ExUdt+aWXdY60rJiMy t4tUK6ewA3aBusRgtGF3z0B6CvgAwhj926VVv3Jk+PZ0XfpQgRt6OU7/Apd0yhcBvfrX FwpTs6QZPmbp1NhyysluH+jzc6myLGjhuL6MBo204MLBojv6GPtATa2GBgMT0ifh5Vk+ fyHrqXXXZTR09hiPG5wXYcQ50ynrW3X4Bywxg5hdndBm1HkbB5P2dCAzlOT+4DyHDaGP fLTO/2a/yGjV7M044O8Rl8HsTE2hnMHExIeBbwoB2+jeNDu6B5onCNYJES2eLHqfrAGG FNew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xFdhNk5nsJDp0fP+o1jjxdXhOlujveYc4TGfWkAd6Tw=; fh=+tbXRzvBy6n8TFYxCAfH1TjJv3vD+PsS9QwQbhnQnNE=; b=TAo6/zVJWL1hBFnv0P+Z3CHaUkYIpc1eU94lkSCUZYmtmjP/GtdrxFBU39LxJLPyNx e7N55nxrmMGeGDilWTJaupuvijN5puFl9M8rJ7EMcHCOXYWU+jPHETU2TiURFOTdRXBq wG+Wo/VI03FefwV+xxvaA9epx27wgu1wKiA5kcVxmq3rqpGSKf8xQUsIRmRYHVW76eUA ApnqRutpyUz3MXHbuEA6iKvJZEcrlABds6tXpjmeyMncqLNHYz+GMehqAR2RNdVeuKxY Pk4ZBI+rJEvxnEZR8GVpr4PZ8wJOH+uU7qpJaIvrQ+uDW/N3gOelGpXck7+RtpO4+gdB nBig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-141527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141527-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r18-20020a170906365200b00a51aaa75b9bsi919593ejb.650.2024.04.11.12.31.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 12:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-141527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141527-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8E1121F2AC81 for ; Thu, 11 Apr 2024 19:24:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 819B621105; Thu, 11 Apr 2024 19:23:28 +0000 (UTC) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C285134B0; Thu, 11 Apr 2024 19:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712863408; cv=none; b=iN5uGrcuXIyVqX33gU3txCH68hcTg8B/RQYJBDNp8HAaM2Jw+x7fZtKTHQiVR7/+WIFbBQKbnll44E9CdQ3MK7IcO+Pi1L5eMdYI/CL0IojWrJYeI5MRIwkkTSMRMEkyM/zjmgzhDpyIeN+AAP/NZX9Mig1gy/3JLEJNvyJeDz8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712863408; c=relaxed/simple; bh=36sh5N/jvpjq6jwl9uDLoGCYQeODe9Y4/Xxq15VmGxU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WreY4DlL/JJObYcBt/xqLUKC6nvvM6Cb76lDO4ZnzIp/VTy/2yIXJLptE0irR4bnjIwbS6+mPk7NvvXwHVaurKH1ViFD1T7eQDOA+w+W/epn9rEZL+PVI3SZEglVJprVL44mCssdlApqQRxQ8yR5NjXte7rooYm1Fip1Q+mkI9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-56fead80bacso198820a12.0; Thu, 11 Apr 2024 12:23:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712863404; x=1713468204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xFdhNk5nsJDp0fP+o1jjxdXhOlujveYc4TGfWkAd6Tw=; b=hAjIAuJxRcDBNV/E8KW9Gy5TEcDDKFP8k1vaGWkC3FSImDNZQLL9vrv51Hd3ubZovX SJf0yDfPLsG0RWqnZaGtF1bra+UBB4opMjXARsE7IdP+FlRvmKQ0EqijdvxlB197r6jR IurG690u3XyS71/mAhHIVesK5X/9zf80JiVmtV2ygIHGwAj7dfqMAHFfJvHaOmyTbkPg ys9DR1VenvLj9ghRmPvwDUa7GnJuqW4CbVFsh5QniEv/1I1fsmO0vJ3tgZXQZdTjWwia 6eAFzLKjHYvpu9bs5ufpqrNoiL5OrL4zJ/Z6upRa2KCPjbp8GIhQXyn3FNkbU5XyW9zW WjLA== X-Forwarded-Encrypted: i=1; AJvYcCUObvQ140bN6YRmPJgC3y1m/qGfgK74bJeP5b9sp6T2Z3sT7NU+XGVVheDQCvQFxCLUm27JNQwRFjPThuSabR4VeBPn4NLZ X-Gm-Message-State: AOJu0YwaA0p7jJLR+HbLXVh241x5fJehi8szfVvliCYGzN3RMJMqkRwQ WY/rx2aHsERnEd8PwYKD/RAi3RNZXHS+ae1FwE2tPedNvU8iW4CZO3tYaQ== X-Received: by 2002:a17:906:3292:b0:a51:c720:5107 with SMTP id 18-20020a170906329200b00a51c7205107mr491692ejw.22.1712863403759; Thu, 11 Apr 2024 12:23:23 -0700 (PDT) Received: from localhost (fwdproxy-lla-004.fbsv.net. [2a03:2880:30ff:4::face:b00c]) by smtp.gmail.com with ESMTPSA id rs6-20020a170907036600b00a4e6626ae21sm1027945ejb.0.2024.04.11.12.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 12:23:23 -0700 (PDT) From: Breno Leitao To: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v3 3/4] net: dql: Optimize stall information population Date: Thu, 11 Apr 2024 12:22:31 -0700 Message-ID: <20240411192241.2498631-4-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411192241.2498631-1-leitao@debian.org> References: <20240411192241.2498631-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When Dynamic Queue Limit (DQL) is set, it always populate stall information through dql_queue_stall(). However, this information is only necessary if a stall threshold is set, stored in struct dql->stall_thrs. dql_queue_stall() is cheap, but not free, since it does have memory barriers and so forth. Do not call dql_queue_stall() if there is no stall threshold set, and save some CPU cycles. Signed-off-by: Breno Leitao --- include/linux/dynamic_queue_limits.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h index 9980df0b7247..869afb800ea1 100644 --- a/include/linux/dynamic_queue_limits.h +++ b/include/linux/dynamic_queue_limits.h @@ -137,7 +137,9 @@ static inline void dql_queued(struct dql *dql, unsigned int count) dql->num_queued += count; - dql_queue_stall(dql); + /* Only populate stall information if the threshold is set */ + if (READ_ONCE(dql->stall_thrs)) + dql_queue_stall(dql); } /* Returns how many objects can be queued, < 0 indicates over limit. */ -- 2.43.0