Re: [RFC PATCH v2] net: sched: convert qdisc linked list to hashtable
From: Eric Dumazet
Date: Fri Jul 08 2016 - 04:50:52 EST
On Thu, 2016-07-07 at 22:36 +0200, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@xxxxxxx>
>
> Convert the per-device linked list into a hashtable. The primary
> motivation for this change is that currently, we're not tracking all the
> qdiscs in hierarchy (e.g. excluding default qdiscs), as the lookup
> performed over the linked list by qdisc_match_from_root() is rather
> expensive.
>
> The ultimate goal is to get rid of hidden qdiscs completely, which will
> bring much more determinism in user experience.
>
> As we're adding hashtable.h include into generic netdevice.h, we have to make
> sure HASH_SIZE macro is now non-conflicting with local definitions.
>
> Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
> ---
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index fdc9de2..0f70ecc 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -62,11 +62,11 @@ module_param(log_ecn_error, bool, 0644);
> MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
>
> #define HASH_SIZE_SHIFT 5
> -#define HASH_SIZE (1 << HASH_SIZE_SHIFT)
> +#define __HASH_SIZE (1 << HASH_SIZE_SHIFT)
__ prefix is mostly used for functions having some kind of
shells/helpers.
I would rather use IP6_GRE_HASH_SIZE or something which has lower
chances of being used elsewhere.
Or maybe you could use new HASH_SIZE(name), providing proper 'name'
@@ -732,6 +730,8 @@ static void attach_default_qdiscs(struct net_device *dev)
> qdisc->ops->attach(qdisc);
> }
> }
> + if (dev->qdisc)
> + qdisc_hash_add(dev->qdisc);
> }
>
I do not understand this addition, could you comment on it ?