On Wed, Feb 14, 2024 at 3:45 PM Breno Leitao <lei...@debian.org> wrote: > > On Tue, Feb 13, 2024 at 10:04:57AM -0800, Jakub Kicinski wrote: > > On Tue, 13 Feb 2024 14:57:49 +0100 Eric Dumazet wrote: > > > Please note that adding other sysfs entries is expensive for workloads > > > creating/deleting netdev and netns often. > > > > > > I _think_ we should find a way for not creating > > > /sys/class/net/<interface>/queues/tx-{Q}/byte_queue_limits directory > > > and files > > > for non BQL enabled devices (like loopback !) > > > > We should try, see if anyone screams. We could use IFF_NO_QUEUE, and > > NETIF_F_LLTX as a proxy for "device doesn't have a real queue so BQL > > would be pointless"? Obviously better to annotate the drivers which > > do have BQL support, but there's >50 of them on a quick count.. > > Let me make sure I understand the suggestion above. We want to disable > BQL completely for devices that has dev->features & NETIF_F_LLTX or > dev->priv_flags & IFF_NO_QUEUE, right? > > Maybe we can add a ->enabled field in struct dql, and set it according > to the features above. Then we can created the sysfs and process the dql > operations based on that field. This should avoid some unnecessary calls > also, if we are not display sysfs. > > Here is a very simple PoC to represent what I had in mind. Am I in the > right direction?
No, this was really about sysfs entries (aka dql_group) Partial patch would be: diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index a09d507c5b03d24a829bf7af0b7cf1e6a0bdb65a..094e3b2d78cca40d810b2fa3bd4393d22b30e6ad 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1709,9 +1709,11 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index) goto err; #ifdef CONFIG_BQL - error = sysfs_create_group(kobj, &dql_group); - if (error) - goto err; + if (netdev_uses_bql(dev)) { + error = sysfs_create_group(kobj, &dql_group); + if (error) + goto err; + } #endif kobject_uevent(kobj, KOBJ_ADD); @@ -1734,7 +1736,8 @@ static int tx_queue_change_owner(struct net_device *ndev, int index, return error; #ifdef CONFIG_BQL - error = sysfs_group_change_owner(kobj, &dql_group, kuid, kgid); + if (netdev_uses_bql(ndev)) + error = sysfs_group_change_owner(kobj, &dql_group, kuid, kgid); #endif return error; } @@ -1768,7 +1771,8 @@ netdev_queue_update_kobjects(struct net_device *dev, int old_num, int new_num) if (!refcount_read(&dev_net(dev)->ns.count)) queue->kobj.uevent_suppress = 1; #ifdef CONFIG_BQL - sysfs_remove_group(&queue->kobj, &dql_group); + if (netdev_uses_bql(dev)) + sysfs_remove_group(&queue->kobj, &dql_group); #endif kobject_put(&queue->kobj); }