diff options
author | Patrick McHardy <kaber@trash.net> | 2008-11-20 07:11:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 07:11:36 -0500 |
commit | b94c8afcba3ae6584653b98e315446ea83be6ea5 (patch) | |
tree | 377fcfaf74e3aa38243c736a440e45b378355d8e /net/sched/sch_prio.c | |
parent | c19d0369d4c791d90fe0b84d6040a897fe25cc14 (diff) |
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_prio.c')
-rw-r--r-- | net/sched/sch_prio.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index ea65a87ec22c..94cecef70145 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -187,7 +187,8 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt) | |||
187 | memcpy(q->prio2band, qopt->priomap, TC_PRIO_MAX+1); | 187 | memcpy(q->prio2band, qopt->priomap, TC_PRIO_MAX+1); |
188 | 188 | ||
189 | for (i=q->bands; i<TCQ_PRIO_BANDS; i++) { | 189 | for (i=q->bands; i<TCQ_PRIO_BANDS; i++) { |
190 | struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc); | 190 | struct Qdisc *child = q->queues[i]; |
191 | q->queues[i] = &noop_qdisc; | ||
191 | if (child != &noop_qdisc) { | 192 | if (child != &noop_qdisc) { |
192 | qdisc_tree_decrease_qlen(child, child->q.qlen); | 193 | qdisc_tree_decrease_qlen(child, child->q.qlen); |
193 | qdisc_destroy(child); | 194 | qdisc_destroy(child); |
@@ -197,18 +198,19 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt) | |||
197 | 198 | ||
198 | for (i=0; i<q->bands; i++) { | 199 | for (i=0; i<q->bands; i++) { |
199 | if (q->queues[i] == &noop_qdisc) { | 200 | if (q->queues[i] == &noop_qdisc) { |
200 | struct Qdisc *child; | 201 | struct Qdisc *child, *old; |
201 | child = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, | 202 | child = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, |
202 | &pfifo_qdisc_ops, | 203 | &pfifo_qdisc_ops, |
203 | TC_H_MAKE(sch->handle, i + 1)); | 204 | TC_H_MAKE(sch->handle, i + 1)); |
204 | if (child) { | 205 | if (child) { |
205 | sch_tree_lock(sch); | 206 | sch_tree_lock(sch); |
206 | child = xchg(&q->queues[i], child); | 207 | old = q->queues[i]; |
208 | q->queues[i] = child; | ||
207 | 209 | ||
208 | if (child != &noop_qdisc) { | 210 | if (old != &noop_qdisc) { |
209 | qdisc_tree_decrease_qlen(child, | 211 | qdisc_tree_decrease_qlen(old, |
210 | child->q.qlen); | 212 | old->q.qlen); |
211 | qdisc_destroy(child); | 213 | qdisc_destroy(old); |
212 | } | 214 | } |
213 | sch_tree_unlock(sch); | 215 | sch_tree_unlock(sch); |
214 | } | 216 | } |