* [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock
@ 2017-02-17 6:34 fgao
2017-02-17 17:42 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: fgao @ 2017-02-17 6:34 UTC (permalink / raw)
To: davem, jhs, netdev, gfree.wind; +Cc: Gao Feng
From: Gao Feng <fgao@ikuai8.com>
The qdisc_stab_lock is used in qdisc_get_stab and qdisc_put_stab.
These two functions are invoked in qdisc_create, qdisc_change, and
qdisc_destroy which run fully under RTNL.
So it already makes sure only one could access the qdisc_stab_list at
the same time. Then it is unnecessary to use qdisc_stab_lock now.
Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
net/sched/sch_api.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index a13c15e..bcf49cd 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -440,7 +440,6 @@ void qdisc_put_rtab(struct qdisc_rate_table *tab)
EXPORT_SYMBOL(qdisc_put_rtab);
static LIST_HEAD(qdisc_stab_list);
-static DEFINE_SPINLOCK(qdisc_stab_lock);
static const struct nla_policy stab_policy[TCA_STAB_MAX + 1] = {
[TCA_STAB_BASE] = { .len = sizeof(struct tc_sizespec) },
@@ -474,20 +473,15 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
if (tsize != s->tsize || (!tab && tsize > 0))
return ERR_PTR(-EINVAL);
- spin_lock(&qdisc_stab_lock);
-
list_for_each_entry(stab, &qdisc_stab_list, list) {
if (memcmp(&stab->szopts, s, sizeof(*s)))
continue;
if (tsize > 0 && memcmp(stab->data, tab, tsize * sizeof(u16)))
continue;
stab->refcnt++;
- spin_unlock(&qdisc_stab_lock);
return stab;
}
- spin_unlock(&qdisc_stab_lock);
-
stab = kmalloc(sizeof(*stab) + tsize * sizeof(u16), GFP_KERNEL);
if (!stab)
return ERR_PTR(-ENOMEM);
@@ -497,9 +491,7 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
if (tsize > 0)
memcpy(stab->data, tab, tsize * sizeof(u16));
- spin_lock(&qdisc_stab_lock);
list_add_tail(&stab->list, &qdisc_stab_list);
- spin_unlock(&qdisc_stab_lock);
return stab;
}
@@ -514,14 +506,10 @@ void qdisc_put_stab(struct qdisc_size_table *tab)
if (!tab)
return;
- spin_lock(&qdisc_stab_lock);
-
if (--tab->refcnt == 0) {
list_del(&tab->list);
call_rcu_bh(&tab->rcu, stab_kfree_rcu);
}
-
- spin_unlock(&qdisc_stab_lock);
}
EXPORT_SYMBOL(qdisc_put_stab);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock
2017-02-17 6:34 [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock fgao
@ 2017-02-17 17:42 ` Eric Dumazet
2017-02-17 18:02 ` Cong Wang
2017-02-17 20:10 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2017-02-17 17:42 UTC (permalink / raw)
To: fgao; +Cc: davem, jhs, netdev, gfree.wind
On Fri, 2017-02-17 at 14:34 +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> The qdisc_stab_lock is used in qdisc_get_stab and qdisc_put_stab.
> These two functions are invoked in qdisc_create, qdisc_change, and
> qdisc_destroy which run fully under RTNL.
>
> So it already makes sure only one could access the qdisc_stab_list at
> the same time. Then it is unnecessary to use qdisc_stab_lock now.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock
2017-02-17 6:34 [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock fgao
2017-02-17 17:42 ` Eric Dumazet
@ 2017-02-17 18:02 ` Cong Wang
2017-02-17 18:22 ` Eric Dumazet
2017-02-17 20:10 ` David Miller
2 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2017-02-17 18:02 UTC (permalink / raw)
To: fgao
Cc: David Miller, Jamal Hadi Salim, Linux Kernel Network Developers,
Feng Gao
On Thu, Feb 16, 2017 at 10:34 PM, <fgao@ikuai8.com> wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> The qdisc_stab_lock is used in qdisc_get_stab and qdisc_put_stab.
> These two functions are invoked in qdisc_create, qdisc_change, and
> qdisc_destroy which run fully under RTNL.
>
> So it already makes sure only one could access the qdisc_stab_list at
> the same time. Then it is unnecessary to use qdisc_stab_lock now.
I posted a (almost) same patch two years ago:
http://marc.info/?l=linux-netdev&m=141512383516640&w=2
Forget why it was not accepted at that time.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock
2017-02-17 18:02 ` Cong Wang
@ 2017-02-17 18:22 ` Eric Dumazet
0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2017-02-17 18:22 UTC (permalink / raw)
To: Cong Wang
Cc: fgao, David Miller, Jamal Hadi Salim,
Linux Kernel Network Developers, Feng Gao
On Fri, 2017-02-17 at 10:02 -0800, Cong Wang wrote:
> On Thu, Feb 16, 2017 at 10:34 PM, <fgao@ikuai8.com> wrote:
> > From: Gao Feng <fgao@ikuai8.com>
> >
> > The qdisc_stab_lock is used in qdisc_get_stab and qdisc_put_stab.
> > These two functions are invoked in qdisc_create, qdisc_change, and
> > qdisc_destroy which run fully under RTNL.
> >
> > So it already makes sure only one could access the qdisc_stab_list at
> > the same time. Then it is unnecessary to use qdisc_stab_lock now.
>
> I posted a (almost) same patch two years ago:
> http://marc.info/?l=linux-netdev&m=141512383516640&w=2
>
> Forget why it was not accepted at that time.
Probably because you sent a huge patch serie, and I was not willing to
spend a full day reviewing it.
Sorry.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock
2017-02-17 6:34 [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock fgao
2017-02-17 17:42 ` Eric Dumazet
2017-02-17 18:02 ` Cong Wang
@ 2017-02-17 20:10 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-02-17 20:10 UTC (permalink / raw)
To: fgao; +Cc: jhs, netdev, gfree.wind
From: fgao@ikuai8.com
Date: Fri, 17 Feb 2017 14:34:19 +0800
> From: Gao Feng <fgao@ikuai8.com>
>
> The qdisc_stab_lock is used in qdisc_get_stab and qdisc_put_stab.
> These two functions are invoked in qdisc_create, qdisc_change, and
> qdisc_destroy which run fully under RTNL.
>
> So it already makes sure only one could access the qdisc_stab_list at
> the same time. Then it is unnecessary to use qdisc_stab_lock now.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-17 20:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 6:34 [PATCH net-next 1/1] pkt_sched: Remove useless qdisc_stab_lock fgao
2017-02-17 17:42 ` Eric Dumazet
2017-02-17 18:02 ` Cong Wang
2017-02-17 18:22 ` Eric Dumazet
2017-02-17 20:10 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.