Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp96832lqp; Thu, 4 Apr 2024 08:01:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWabb969LsdK/J9qw+1Mdkit8qlaTYsOVPLQ2XENCZjA5YGlUt3dgFrjqy7j61r4EeuD/AAKfDtR6QsJOt0R4trW5FR+Uthy6HPV8/68A== X-Google-Smtp-Source: AGHT+IGr6aAfwMk7tNYILALalOzwJhoo5h6gpy0p/dcEWFOTHcyXaFWm6ueIfFehM2qu10iGTags X-Received: by 2002:a50:c348:0:b0:565:6c72:40a9 with SMTP id q8-20020a50c348000000b005656c7240a9mr11182edb.28.1712242905181; Thu, 04 Apr 2024 08:01:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712242905; cv=pass; d=google.com; s=arc-20160816; b=wROSVHLmsyLEwqQ/J1uNPZjXzgbod1AeYqvKq/wk7eU4erkB03GHhjjycDb+UH2JCI sZJyltChNHTsGp2RwRzrcHO9p4qHP2IqcCMuCztvrao01Fc4w0saw3QjNzgki3xTe+x3 iNBl+QAN4jBHHzyFXIXAZqlFVYkxG/gqD+7m8XVQ25lhkCWx41n270AgoqBkvl4tcjQt D3xEF6lcBTxogprewoO+b2GHrkOCnFE4wmpFiXVYm47/SVCjHj7PQsT6s69Gvv3lNL5S gD+1J8nwYuBFMy83FUxkV9I2Iv1MaDISd30lnKj799nbX6Q0OIbnDxpdI+7zB7pOWFq8 SIzw== 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=eBL4XWUl7NbXvBXNyoEZhzyh4lK/Gv/OO5DiuxQdS8s=; b=zmNsmbqSoJCDAg2L8hC8BNmJA5m3CAL3mJyur7e0z+Ab2GNAzvV3mUeX0QPdcNUGDU RjjZ0W0aUK9T2nQyXulStWCTUFnxS3Y0qD7JG1jvM8vaWTpIKuWDZ4z80LOvo80cL64l w6DPJDZ9I5FaBNb6wrNY49JsWBWIlcfvS1SbUX8Rp3aAZ2Z+k9uk7YfuXVK0lD4H+8+A wio2TRazagruO24wU0bXXcGwA0MQedKPMFNFPtEyxBBVsAP5Hmtmc7IMOqxTs4XcY1z/ Re4dKbvwfve59MyQYG0Su2R0bKiywf3XEjo0717rU5SlK0q63WYWvhg74FjhuZfgxKHS I54w==; 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-131665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131665-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r18-20020a50c012000000b005687bbe457bsi8154326edb.613.2024.04.04.08.01.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 08:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131665-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 D15301F28F3F for ; Thu, 4 Apr 2024 15:01:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77E3B12CDAA; Thu, 4 Apr 2024 15:00:28 +0000 (UTC) Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 56D0D1C698; Thu, 4 Apr 2024 15:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712242828; cv=none; b=QhnPNXCMOdcUAMyf3QWh+jqUGLgk3+Qalq6IfcMNf+OaVafKuCVMmBwKvzFOAYnOF6yVWGwZiXex8Yu15HiJk3VcW4kWm3B1pcL3NwDAbkEuhGDqsEFxVhx1PZM3SxJuoFQ3AF12/ewTL24VcqQx8GD5YGh70dlQizEeJTIjd58= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712242828; c=relaxed/simple; bh=36sh5N/jvpjq6jwl9uDLoGCYQeODe9Y4/Xxq15VmGxU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dy59jXNMz9JhiuMWrE135PJSW/TU6xCIjHdyUEqLAauhTBNnagdRuEOSOfhExGonh/0RD3yK5FFCm14Uo2jv9FBhT8KPvi6sgcVISjA1QAUrOBQ/iwvPWXflkY07Ph5VSbvKtvL4tCTEtELZOPtqLmv4ZbPayXbI3eSxXMvxC0Q= 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.43 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-f43.google.com with SMTP id 4fb4d7f45d1cf-56b0af675deso1246728a12.1; Thu, 04 Apr 2024 08:00:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712242825; x=1712847625; 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=uEVuq165XJwzhECe733ybaBBv/yHZXeOxdezMghUt643+sfEjxa09Qv23obL4Sc5DV PbmOVL4V/SgP/ddfASOrlYLgWe9zwAzaQ+0lztWgnIWFId/tylVIBimpN5hiIlZQPKvs aHafTaAXBb3GjoKjy3HLfRubBsHbGASvlMQBFgrsTrNAYZrRcJ/Y7WaOFWKEaCSrAqIw vykUypDxrw6T5LYNkZxr41L+sFuVHAC8caMBibKyBdKOmosisuxp5S+pAQJOd171wtGR 056iPoLRfh3BuerDRUbdjcqlxwP5dP5ksi8RfiWY/7A0hgXhBqJKOckcibAPgOZt8GXB vqmA== X-Forwarded-Encrypted: i=1; AJvYcCVlFhQuz3nKjTjko/rYnm+kLcgQdmVd1ViIXB7gX+KTbZ4KFCApbtlpI6Vj7UWSTkC/GW9Vf5bdAll3q6B/PDtmfUupXy8p X-Gm-Message-State: AOJu0Yz02GGbupYWJdZKpgdvf/nIfoaEYl3+Tly+ztNUOsWfrLh43n93 R5xVxvq2O85C4ETkLCgxJIvBEoMSc/iJaDvm3XAoCBTsn9lwxKF64LuexYdk X-Received: by 2002:a50:d7c2:0:b0:56b:cfef:b2de with SMTP id m2-20020a50d7c2000000b0056bcfefb2demr6344edj.26.1712242824689; Thu, 04 Apr 2024 08:00:24 -0700 (PDT) Received: from localhost (fwdproxy-lla-120.fbsv.net. [2a03:2880:30ff:78::face:b00c]) by smtp.gmail.com with ESMTPSA id dh26-20020a0564021d3a00b0056e0b358e86sm1816264edb.97.2024.04.04.08.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 08:00:24 -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 3/3] net: dql: Optimize stall information population Date: Thu, 4 Apr 2024 07:59:32 -0700 Message-ID: <20240404145939.3601097-4-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240404145939.3601097-1-leitao@debian.org> References: <20240404145939.3601097-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