netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	horms@kernel.org, Johannes Berg <johannes.berg@intel.com>,
	Amritha Nambiar <amritha.nambiar@intel.com>
Subject: Re: [PATCH net-next] net: sysfs: Do not create sysfs for non BQL device
Date: Thu, 15 Feb 2024 07:24:59 -0800	[thread overview]
Message-ID: <20240215072459.2e3697ee@kernel.org> (raw)
In-Reply-To: <20240215112729.1778958-1-leitao@debian.org>

On Thu, 15 Feb 2024 03:27:27 -0800 Breno Leitao wrote:
> Creation of sysfs entries is expensive, mainly for workloads that
> constantly creates netdev and netns often.
> 
> Do not create BQL sysfs entries for devices that don't need,
> basically those that do not have a real queue, i.e, devices that has
> NETIF_F_LLTX and IFF_NO_QUEUE, such as `lo` interface.
> 
> This will remove the /sys/class/net/eth0/queues/tx-X/byte_queue_limits/
> directory for these devices.
> 
> In the example below, eth0 has the `byte_queue_limits` directory but not
> `lo`.
> 
> 	# ls /sys/class/net/lo/queues/tx-0/
> 	traffic_class  tx_maxrate  tx_timeout  xps_cpus  xps_rxqs
> 
> 	# ls /sys/class/net/eth0/queues/tx-0/byte_queue_limits/
> 	hold_time  inflight  limit  limit_max  limit_min

I'm tempted to also get rid of the #ifdefs while at it.

> +static bool netdev_uses_bql(struct net_device *dev)
> +{
> +	if (dev->features & NETIF_F_LLTX ||
> +	    dev->priv_flags & IFF_NO_QUEUE)
> +		return false;
> +
> +	return true;

make this
	return IS_ENABLED(CONFIG_BQL);

And throw in something like:

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index a09d507c5b03..119075dff0ee 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1454,6 +1454,9 @@ static const struct attribute_group dql_group = {
        .name  = "byte_queue_limits",
        .attrs  = dql_attrs,
 };
+#else
+/* Fake declaration, all the code using it should be dead */
+extern const struct attribute_group dql_group;
 #endif /* CONFIG_BQL */
 
 #ifdef CONFIG_XPS

You should then be able to remove the #ifdef CONFIG_BQL around the
uses of netdev_uses_bql(), compiler will realize it always returns
false and eliminate the code making use of &dql_group.

      parent reply	other threads:[~2024-02-15 15:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 11:27 [PATCH net-next] net: sysfs: Do not create sysfs for non BQL device Breno Leitao
2024-02-15 12:47 ` Eric Dumazet
2024-02-15 13:11   ` Breno Leitao
2024-02-15 15:24 ` Jakub Kicinski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240215072459.2e3697ee@kernel.org \
    --to=kuba@kernel.org \
    --cc=amritha.nambiar@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=johannes.berg@intel.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).