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>
This commit is contained in:
committed by
David S. Miller
parent
c19d0369d4
commit
b94c8afcba
@@ -187,7 +187,8 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt)
|
||||
memcpy(q->prio2band, qopt->priomap, TC_PRIO_MAX+1);
|
||||
|
||||
for (i=q->bands; i<TCQ_PRIO_BANDS; i++) {
|
||||
struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc);
|
||||
struct Qdisc *child = q->queues[i];
|
||||
q->queues[i] = &noop_qdisc;
|
||||
if (child != &noop_qdisc) {
|
||||
qdisc_tree_decrease_qlen(child, child->q.qlen);
|
||||
qdisc_destroy(child);
|
||||
@@ -197,18 +198,19 @@ static int prio_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,
|
||||
TC_H_MAKE(sch->handle, 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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user