Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1438717

Re: [RFC PATCH] net: sched: convert qdisc linked list to hashtable (was Re: Deleting child qdisc doesn't reset parent to default qdisc?)

Path csiph.com!news.redatomik.org!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Jiri Kosina <jikos@kernel.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] net: sched: convert qdisc linked list to hashtable (was Re: Deleting child qdisc doesn't reset parent to default qdisc?)
Date Thu, 07 Jul 2016 18:40:01 +0200
Message-ID <rSkvf-ZX-11@gated-at.bofh.it> (permalink)
References <rnQKL-3gf-29@gated-at.bofh.it> <rnR48-3Fm-83@gated-at.bofh.it> <rnRdM-3Ro-31@gated-at.bofh.it> <rnS0b-4DT-27@gated-at.bofh.it> <rnTyX-5JF-39@gated-at.bofh.it> <robma-36m-15@gated-at.bofh.it> <rodnY-4BO-5@gated-at.bofh.it> <rSdtM-4Uf-29@gated-at.bofh.it> <rSi0q-7C9-21@gated-at.bofh.it>
X-X-Sender jkosina@pobox.suse.cz
User-Agent Alpine 2.00 (LNX 1167 2008-08-23)
MIME-Version 1.0
Content-Type TEXT/PLAIN; charset=US-ASCII
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 63
Organization linux.* mail to news gateway
X-Original-Cc Craig Gallek <kraigatgoog@gmail.com>, Jamal Hadi Salim <jhs@mojatatu.com>, Phil Sutter <phil@nwl.cc>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Thu, 7 Jul 2016 18:32:23 +0200 (CEST)
X-Original-Message-ID <alpine.LNX.2.00.1607071823290.24757@cbobk.fhfr.pm>
X-Original-References <alpine.LNX.2.00.1604141638230.27368@cbobk.fhfr.pm> <1460646099.10638.44.camel@edumazet-glaptop3.roam.corp.google.com> <20160414151813.GE3715@orbyte.nwl.cc> <alpine.LNX.2.00.1604141807350.27368@cbobk.fhfr.pm> <1460656170.10638.61.camel@edumazet-glaptop3.roam.corp.google.com> <5710E1C1.2090209@mojatatu.com> <1460732328.10638.74.camel@edumazet-glaptop3.roam.corp.google.com> <alpine.LNX.2.00.1607071102010.24757@cbobk.fhfr.pm> <1467899463.1273.37.camel@edumazet-glaptop3.roam.corp.google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1438717

Show key headers only | View raw


On Thu, 7 Jul 2016, Eric Dumazet wrote:

> > @@ -1440,6 +1441,7 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
> >  {
> >  	int ret = 0, q_idx = *q_idx_p;
> >  	struct Qdisc *q;
> > +	int b;
> >  
> >  	if (!root)
> >  		return 0;
> > @@ -1454,7 +1456,7 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
> >  			goto done;
> >  		q_idx++;
> >  	}
> > -	list_for_each_entry(q, &root->list, list) {
> > +	hash_for_each(qdisc_dev(root)->qdisc_hash, b, q, hash) {
> >  		if (q_idx < s_q_idx) {
> >  			q_idx++;
> >  			continue;
> > @@ -1771,6 +1773,7 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
> >  			       int *t_p, int s_t)
> >  {
> >  	struct Qdisc *q;
> > +	int b;
> >  
> >  	if (!root)
> >  		return 0;
> > @@ -1778,7 +1781,7 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
> >  	if (tc_dump_tclass_qdisc(root, skb, tcm, cb, t_p, s_t) < 0)
> >  		return -1;
> >  
> > -	list_for_each_entry(q, &root->list, list) {
> > +	hash_for_each_rcu(qdisc_dev(root)->qdisc_hash, b, q, hash) {
> >  		if (tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
> >  			return -1;
> >  	}
> 
> 
> Not sure why you used the rcu version here, but the non rcu version in
> tc_dump_qdisc_root()

Good catch.

Actually even the current code is odd in this regard -- 
qdisc_match_from_root() uses RCU iterator, while tc_dump_*() use the 
non-RCU one; addition and deletion is performed using RCU primitives.

I haven't got my head around this yet; if it's correct at all, it'd at 
least deserve a comment somewhere.

I'll respin v2 of the patch (there is also a conflict on HASH_SIZE 
definition in ip6_tunnel.c, ip6_gre.c and sit.c due to hashtable.h include 
in netdevice.h that needs to be resolved as well) that'd make RCU usage 
consistent.

Any other objections/comments? I was namely curious about any opinions 
regarding the hashtable size.

Thanks,

-- 
Jiri Kosina
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] net: sched: convert qdisc linked list to hashtable (was  Re: Deleting child qdisc doesn't reset parent to default qdisc?) Jiri Kosina <jikos@kernel.org> - 2016-07-07 11:10 +0200
  Re: [RFC PATCH] net: sched: convert qdisc linked list to hashtable  (was Re: Deleting child qdisc doesn't reset parent to default qdisc?) Eric Dumazet <eric.dumazet@gmail.com> - 2016-07-07 16:00 +0200
    Re: [RFC PATCH] net: sched: convert qdisc linked list to hashtable  (was Re: Deleting child qdisc doesn't reset parent to default qdisc?) Jiri Kosina <jikos@kernel.org> - 2016-07-07 18:40 +0200
      Re: [RFC PATCH] net: sched: convert qdisc linked list to hashtable  (was Re: Deleting child qdisc doesn't reset parent to default qdisc?) Eric Dumazet <eric.dumazet@gmail.com> - 2016-07-07 19:00 +0200
  [RFC PATCH v2] net: sched: convert qdisc linked list to hashtable Jiri Kosina <jikos@kernel.org> - 2016-07-07 22:40 +0200
    Re: [RFC PATCH v2] net: sched: convert qdisc linked list to  hashtable Eric Dumazet <eric.dumazet@gmail.com> - 2016-07-08 11:00 +0200
      Re: [RFC PATCH v2] net: sched: convert qdisc linked list to  hashtable Jiri Kosina <jikos@kernel.org> - 2016-07-08 11:10 +0200
    Re: [RFC PATCH v2] net: sched: convert qdisc linked list to hashtable Thomas Graf <tgraf@suug.ch> - 2016-07-08 13:10 +0200
      Re: [RFC PATCH v2] net: sched: convert qdisc linked list to  hashtable Eric Dumazet <eric.dumazet@gmail.com> - 2016-07-08 16:00 +0200

csiph-web