diff options
author | Patrick McHardy <kaber@trash.net> | 2008-11-20 04:11:36 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 04:11:36 -0800 |
commit | b94c8afcba3ae6584653b98e315446ea83be6ea5 (patch) | |
tree | 377fcfaf74e3aa38243c736a440e45b378355d8e /net/sched/sch_multiq.c | |
parent | c19d0369d4c791d90fe0b84d6040a897fe25cc14 (diff) | |
download | linux-b94c8afcba3ae6584653b98e315446ea83be6ea5.tar.gz linux-b94c8afcba3ae6584653b98e315446ea83be6ea5.tar.bz2 linux-b94c8afcba3ae6584653b98e315446ea83be6ea5.zip |
pkt_sched: remove unnecessary xchg() in packet schedulers
The use of xchg() hasn't been necessary since 2.2.something when proper
locking was added to packet schedulers.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_multiq.c')
-rw-r--r-- | net/sched/sch_multiq.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c index f645ac55a1a1..7e151861794b 100644 --- a/net/sched/sch_multiq.c +++ b/net/sched/sch_multiq.c @@ -214,7 +214,8 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt) q->bands = qopt->bands; for (i = q->bands; i < q->max_bands; i++) { if (q->queues[i] != &noop_qdisc) { - struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc); + struct Qdisc *child = q->queues[i]; + q->queues[i] = &noop_qdisc; qdisc_tree_decrease_qlen(child, child->q.qlen); qdisc_destroy(child); } @@ -224,7 +225,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt) for (i = 0; i < q->bands; i++) { if (q->queues[i] == &noop_qdisc) { - struct Qdisc *child; + struct Qdisc *child, *old; child = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, &pfifo_qdisc_ops, @@ -232,12 +233,13 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt) i + 1)); if (child) { sch_tree_lock(sch); - child = xchg(&q->queues[i], child); + old = q->queues[i]; + q->queues[i] = child; - if (child != &noop_qdisc) { - qdisc_tree_decrease_qlen(child, - child->q.qlen); - qdisc_destroy(child); + if (old != &noop_qdisc) { + qdisc_tree_decrease_qlen(old, + old->q.qlen); + qdisc_destroy(old); } sch_tree_unlock(sch); } |