Re: [RFC PATCH v2] net: sched: convert qdisc linked list to hashtable

From: Jiri Kosina
Date: Fri Jul 08 2016 - 05:02:58 EST


On Fri, 8 Jul 2016, Eric Dumazet wrote:

> > 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.

Alright, makes sense, will do this in v3.

> @@ -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 ?

With linked lists, assigning to struct net_device's Qdisc pointer is
enough to "initialize" the linked list and have it contain one (root)
item. With hashtable, this is not the case, it needs to be explicitly
added.

Hmm, dev_init_scheduler() (and perhaps also dev_shutdown()) would possibly
need similar treatment in order to have accurate data there 100% of the
time even during initialization.

--
Jiri Kosina
SUSE Labs