Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1497565lqe; Mon, 8 Apr 2024 10:27:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHIyOluhQas+oT3L4RKTSkVJa7wOP9bTN7q5o5CaqwNaxThIqf130JK1VYViFXJFQT7+eU15mH94NrC9K64RtaPAIWrqdXYvd24lWhVA== X-Google-Smtp-Source: AGHT+IH4Zs7qz9THfmj6GQ7Gag6Z5+gUnLjAuA2b5WLGvGVxeEZKagGukWyOMs2mAxDbLUtwkj1V X-Received: by 2002:ac2:4c01:0:b0:516:c3b2:91e6 with SMTP id t1-20020ac24c01000000b00516c3b291e6mr6929841lfq.69.1712597227848; Mon, 08 Apr 2024 10:27:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712597227; cv=pass; d=google.com; s=arc-20160816; b=qrKFLSmhZMTtOjpiNuhDTXjYsg6VCUcoU7VTqIydW917F0T3/2CHwj3Kfh1UFcTxmq oQTNzi2YVbAWzSkMetjsRMZXXGFfIi2H9vM6NINu0VFmIG/aL66SASdez7U16doXSmCF +v1DNR3ozN1juYMNvMlnMoU6BUxAY14mJt5KPBIG3Y4CE6ab+GfVS9ZJaI8dYkJf6HZh 5SEHIAh7xHbANmPnV/8RH6wJxrUt42ZwhG08zo/S1jhFOh6lOmlO9yW0fI+8lrxXSj96 cIFFgBmnTVJsolbR5v7LyVzwmbIXixkSWo6ec9S3xevxRohD4yt5YrhxsJIKfioMlB51 nfPw== 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=paTFBSv9k5Css2VTrGJbS2El8OYzks0WGUtONbsf2ng=; b=d72THtoQLFJGn09Z3jV4W/LcaJx0t3vhfaoS5e+PdhznleZ8zdHRGjZ0S0/VEdTPiu Y+T9aIODu4oJEBOicRfOV6zT34JHmwJVrIdirmQDaZ08djW0RVFpaxfOR4kjTLUs7PIY nfs3wyCqlrOtAc9ubZ5YE2Nhf9lkQJcPZxFiVGsAQDKLiotWKILrOLKDOwxgtzYviA0V Oa8Vu2WYpFzsZ5vvT0n/ywjwPYWJvsT+AN61Tw+fJQtzVFVk+2pEbIcweJ4NWKFx7ofU Mu7p067fEtX18IRuk4hPnPzSosd/RTx2Ne79xgQ19SUjT+qLtn6Sb+rS/OHSEKaTOctR 57Iw==; 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-135748-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135748-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 i17-20020a170906251100b00a51d8a3a631si998522ejb.618.2024.04.08.10.27.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:27:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135748-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-135748-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135748-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 8EDD71F27750 for ; Mon, 8 Apr 2024 17:27:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BD97145354; Mon, 8 Apr 2024 17:26:26 +0000 (UTC) Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 24B40144D25; Mon, 8 Apr 2024 17:26:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712597185; cv=none; b=bvhP6m1+1x8ysgDEOWg6uzXC33yahYlre2uXDnMLQBvNePMYuymtttb2CiwVH6Qw+YJp+xTFF3Jv+tdgEVHdU7WYjH6nIKmSmd7DMhK3wLt6M2D0/M//O1FBegIwH3QjqppyDhJRFwGc+E1Zp+AxZnZKXzWW6UitRs/H/7lRsHM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712597185; c=relaxed/simple; bh=36sh5N/jvpjq6jwl9uDLoGCYQeODe9Y4/Xxq15VmGxU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m2GRsqddBPi4f3Rdx+AeZ3SSuSFtNkPxWZbRS8D74txJXCdj8cgq24MzaIevbjn9kskR+/4UDglJBCKt5CeD9IXxop5C00/qVJYOh9jO9ht1OKNWDOD5lFRssGyukiEnS1lqwgHhNUczMNSQrYueYBrNyGqECuCj3hwFebgsmNQ= 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.47 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-f47.google.com with SMTP id 4fb4d7f45d1cf-56e1f3462caso4842659a12.3; Mon, 08 Apr 2024 10:26:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712597182; x=1713201982; 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=NOQvsuMKInzZPBggOCNCNiRbhEAhM20w39RKeFYahie66OHMFUezMEDThYIEVNMfyS YcmYnpg3MIMh0UuI2reYvUfSKQ2/uDjIYeBbAxea6UERexeAeBt0X2VxYhx35IqDvK8o DhUza0mft4CpMR+an2MGu+BsknLvTuMpyq9EDw5AwDODYI1l/yD1AZmPiQk3oUaaks1k tpFQgMbtRrJieIJ6kHPgxHTM4HHSJ+3u1VLaLssmQskhWE0X+RNs9piS9ejammLMneAq UQdt8wYtr7NX50E4R1BXaizvpxrpcanUs7qPQYtzVThptMwOyQDIVzEBKYlH8xh4BPtr MdfQ== X-Forwarded-Encrypted: i=1; AJvYcCWh6YW9Ol+f5mMl7FC0YOeGMb0NrX/SZyzNslZVqtnvZn6DBIvPHwuxVncPfn8foDPuCg00bwqfSwrea4bkxipKYibbxqCP X-Gm-Message-State: AOJu0Yx7poLWq/xQGU5rfO1XIO8uWNzfv8CYf/BGV6FM2carAbliQIyw hNRED6xOnLohzUCiG996AkCRDXftmWjAqYu4PX+rcBlRS1DUtFAs X-Received: by 2002:a17:907:7ea2:b0:a47:16d1:113f with SMTP id qb34-20020a1709077ea200b00a4716d1113fmr8250630ejc.47.1712597182466; Mon, 08 Apr 2024 10:26:22 -0700 (PDT) Received: from localhost (fwdproxy-lla-006.fbsv.net. [2a03:2880:30ff:6::face:b00c]) by smtp.gmail.com with ESMTPSA id gx26-20020a1709068a5a00b00a46b4c09670sm4695689ejc.131.2024.04.08.10.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:26:22 -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 v2 3/4] net: dql: Optimize stall information population Date: Mon, 8 Apr 2024 10:25:55 -0700 Message-ID: <20240408172605.635508-4-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240408172605.635508-1-leitao@debian.org> References: <20240408172605.635508-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