Skip to contentSkip to conversation

Practical performance change to qdisc_lookup

DISCUSSION Bart 1 participant 1 message Jul 2, 2010

Subsystems (2)
lore
Share & tools
lore

Bart

author
#0 lore raw

While looking to speed up our batch processing of many-thousands of TC rules I stumbled across a usage-based optimization of qdisc_lookup().

while not a algorithmic optimization, I would wager that future rules are likely to refer to the more recently created qdiscs and not the oldest ones.

It is silly, but I thought I'd survey opinions on the change. It is far less code entropy than say, implementing a hash lookup.

sch_api.c:
@@ -197,7 +197,7 @@
root->handle == handle)
return root;

- list_for_each_entry(q, &root->list, list) {
+ list_for_each_entry_reverse(q, &root->list, list) {
if (q->handle == handle)
return q;
}