sch_cbq: deactivating when grafting, purging etc.
Subsystems (3)
PATCH 1/1 sch_cbq: deactivating when grafting, purging etc.
Here are some fixes proposals suggested by Patrick McHardy.
[NET_SCHED] sch_cbq:
- deactivating of active classes when grafting
- purging of queue/q.qlen adjustment when deleting an active class
- deactivating of active classes when q.qlen drops to zero in ->drop()
- a redundant instruction removed from cbq_deactivate_class (my own suggestion)
PS: - purging of queue and deactivating of active classes when attaching a new child - not done (according to man, CBQ can carry packets in any type of nodes).
---
net/sched/sch_cbq.c +9 -4
@@ -371,8 +371,6 @@ static void cbq_deactivate_class(structreturn ; } } - - cl = cl_prev->next_alive;return ; } }while ((cl_prev = cl) != q->active[prio]);
@@ -1258,6 +1256,8 @@ static unsigned int cbq_drop(struct Qdisdo {if (cl->q->ops->drop && (len = cl->q->ops->drop (cl->q))) { sch->q.qlen--; +if (!cl->q->q.qlen) +cbq_deactivate_class (cl);return len; } }while ((cl = cl->next_alive) != cl_head);
@@ -1683,8 +1683,10 @@ static int cbq_graft(struct Qdisc *sch,#endif }sch_tree_lock (sch); - *old = cl->q; - cl->q = new; +if (cl->next_alive) +cbq_deactivate_class (cl); + + *old =xchg (&cl->q, new); sch->q.qlen -= (*old)->q.qlen;qdisc_reset (*old);sch_tree_unlock (sch);
@@ -1992,6 +1994,9 @@ static int cbq_delete(struct Qdisc *sch,sch_tree_lock (sch); + sch->q.qlen -= cl->q->q.qlen; +qdisc_reset (cl->q); +if (cl->next_alive)cbq_deactivate_class (cl);
Quoted 8 lines · Jarek Poplawski
Here are some fixes proposals suggested by Patrick McHardy.
[
NET_SCHED]sch_cbq:- deactivating of active classes when grafting
- purging of queue/q.qlen adjustment when deleting an active class
Quoted 8 lines
- deactivating of active classes when q.qlen drops to zero in ->drop()
- a redundant instruction removed from
cbq_deactivate_class(my own suggestion)PS: - purging of queue and deactivating of active classes when attaching a new child - not done (according to man, CBQ can carry packets in any type of nodes).
Your patch looks good, but it conflicts with my patches.
One thing I forgot to mention is that it should also have a callback for deactivating classes when their childs become empty. If you do that you can just call disc_tree_decrement_qlen in graft/delete, which will take care of the qlen decrement and class deactivation.
Quoted 14 lines · Patrick McHardy
Quoted 13 lines · Jarek Poplawski
Here are some fixes proposals suggested by Patrick McHardy.
[
NET_SCHED]sch_cbq:- deactivating of active classes when grafting
- purging of queue/q.qlen adjustment when deleting an active class
- deactivating of active classes when q.qlen drops to zero in ->drop()
- a redundant instruction removed from
cbq_deactivate_class(my own suggestion)
Quoted 6 lines
Quoted 3 lines
PS: - purging of queue and deactivating of active classes when attaching a new child - not done (according to man, CBQ can carry packets in any type of nodes).
Your patch looks good, but it conflicts with my patches.
I know, but I wasn't sure which version this changes are needed for. If there will be something more to do, name the version, please.
Quoted 5 lines
One thing I forgot to mention is that it should also have a callback for deactivating classes when their childs become empty. If you do that you can just call
disc_tree_decrement_qlenin graft/delete, which will take care of the qlen decrement and class deactivation.
If I understand correctly I should apply this to the version after your patch (plus the missing cbq part of "endless loops"). I'll try.
Quoted 8 lines · Jarek Poplawski
Quoted 1 line · Patrick McHardy
Your patch looks good, but it conflicts with my patches.
I know, but I wasn't sure which version this changes are needed for. If there will be something more to do, name the version, please.
Just add it on top of them. They apply cleanly to the current -git tree.
Quoted 10 lines
Quoted 5 lines
One thing I forgot to mention is that it should also have a callback for deactivating classes when their childs become empty. If you do that you can just call
disc_tree_decrement_qlenin graft/delete, which will take care of the qlen decrement and class deactivation.If I understand correctly I should apply this to the version after your patch (plus the missing cbq part of "endless loops"). I'll try.
Thanks.
PATCH 1/1 sch_cbq: deactivating when grafting, purging etc.
[NET_SCHED] sch_cbq:
[PATCH 2.6.19-rc6 with "Fix endless loops" set of patches]
- P. McHardy's "Fix endless loops" patch supplement (cbq_graft, cbq_qlen_notify, cbq_delete, cbq_class_ops)
- deactivating of active classes when q.qlen drops to zero (cbq_drop)
- a redundant instruction removed from cbq_deactivate_class
PS: probably htb_deactivate in htb_delete andcbq_deactivate_class in cbq_delete are also
redundant now.
---
net/sched/sch_cbq.c +17 -4
@@ -371,8 +371,6 @@ static void cbq_deactivate_class(structreturn ; } } - - cl = cl_prev->next_alive;return ; } }while ((cl_prev = cl) != q->active[prio]);
@@ -1258,6 +1256,8 @@ static unsigned int cbq_drop(struct Qdisdo {if (cl->q->ops->drop && (len = cl->q->ops->drop (cl->q))) { sch->q.qlen--; +if (!cl->q->q.qlen) +cbq_deactivate_class (cl);return len; } }while ((cl = cl->next_alive) != cl_head);
@@ -1685,8 +1685,7 @@ static int cbq_graft(struct Qdisc *sch,#endif }sch_tree_lock (sch); - *old = cl->q; - cl->q = new; + *old =xchg (&cl->q, new);qdisc_tree_decrease_qlen (*old, (*old)->q.qlen);qdisc_reset (*old);sch_tree_unlock (sch);
@@ -1704,6 +1703,14 @@ cbq_leaf(struct Qdisc *sch, unsigned lonreturn cl ? cl->q :NULL ; } +static void cbq_qlen_notify (struct Qdisc *sch,unsigned long arg) +{ +struct cbq_class *cl = (struct cbq_class *)arg; + +if (cl->q->q.qlen ==0 ) +cbq_deactivate_class (cl); +} +static unsigned long cbq_get (struct Qdisc *sch,u32 classid) {struct cbq_sched_data *q =qdisc_priv (sch);
@@ -1988,12 +1995,17 @@ static int cbq_delete(struct Qdisc *sch, {struct cbq_sched_data *q =qdisc_priv (sch);struct cbq_class *cl = (struct cbq_class *)arg; +unsigned int qlen;if (cl->filters || cl->children || cl == &q->link)return -EBUSY ;sch_tree_lock (sch); + qlen = cl->q->q.qlen; +qdisc_reset (cl->q); +qdisc_tree_decrease_qlen (cl->q, qlen); +if (cl->next_alive)cbq_deactivate_class (cl);
@@ -2084,6 +2096,7 @@ static void cbq_walk(struct Qdisc *sch,static struct Qdisc_class_ops cbq_class_ops = { .graft = cbq_graft, .leaf = cbq_leaf, + .qlen_notify = cbq_qlen_notify, .get = cbq_get, .put = cbq_put, .change = cbq_change_class,
Quoted 7 lines · Jarek Poplawski
[
NET_SCHED]sch_cbq:[PATCH 2.6.19-rc6 with "Fix endless loops" set of patches]
- P. McHardy's "Fix endless loops" patch supplement (
cbq_graft,cbq_qlen_notify,cbq_delete,cbq_class_ops)
Quoted 8 lines
- deactivating of active classes when q.qlen drops to zero (
cbq_drop)- a redundant instruction removed from
cbq_deactivate_classPS: probably
htb_deactivateinhtb_deleteandcbq_deactivate_classincbq_deleteare also
redundant now.
This looks good, thanks.
From: Patrick McHardy <[email protected]>
Date: Thu, 30 Nov 2006 13:22:47 +0100
Quoted 11 lines
Quoted 10 lines · Jarek Poplawski
[
NET_SCHED]sch_cbq:[PATCH 2.6.19-rc6 with "Fix endless loops" set of patches]
- P. McHardy's "Fix endless loops" patch supplement (
cbq_graft,cbq_qlen_notify,cbq_delete,cbq_class_ops)- deactivating of active classes when q.qlen drops to zero (
cbq_drop)
Quoted 7 lines
Quoted 5 lines
- a redundant instruction removed from
cbq_deactivate_classPS: probably
htb_deactivateinhtb_deleteandcbq_deactivate_classincbq_deleteare also
redundant now.This looks good, thanks.
Applied, thanks everyone.