diff options
author | Eric Dumazet <edumazet@google.com> | 2013-06-06 17:53:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-12 03:14:21 -0400 |
commit | 64153ce0a7b61b2a5cacb01805cbf670142339e9 (patch) | |
tree | f5c854262ef7e05271151391debac6aecad110b0 /net/sched | |
parent | 130d3d68b52097c7ae081109f700b02776adcb9c (diff) |
net_sched: htb: do not setup default rate estimators
With a thousand htb classes, est_timer() spends ~5 million cpu cycles
and throws out cpu cache, because each htb class has a default
rate estimator (est 4sec 16sec).
Most users do not use default rate estimators, so switch htb
to not setup ones.
Add a module parameter (htb_rate_est) so that users relying
on this default rate estimator can revert the behavior.
echo 1 >/sys/module/sch_htb/parameters/htb_rate_est
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_htb.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 162fb800754c..1a3655a606c1 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -65,6 +65,10 @@ static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis f | |||
65 | module_param (htb_hysteresis, int, 0640); | 65 | module_param (htb_hysteresis, int, 0640); |
66 | MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate"); | 66 | MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate"); |
67 | 67 | ||
68 | static int htb_rate_est = 0; /* htb classes have a default rate estimator */ | ||
69 | module_param(htb_rate_est, int, 0640); | ||
70 | MODULE_PARM_DESC(htb_rate_est, "setup a default rate estimator (4sec 16sec) for htb classes"); | ||
71 | |||
68 | /* used internaly to keep status of single class */ | 72 | /* used internaly to keep status of single class */ |
69 | enum htb_cmode { | 73 | enum htb_cmode { |
70 | HTB_CANT_SEND, /* class can't send and can't borrow */ | 74 | HTB_CANT_SEND, /* class can't send and can't borrow */ |
@@ -1366,12 +1370,14 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1366 | if (!cl) | 1370 | if (!cl) |
1367 | goto failure; | 1371 | goto failure; |
1368 | 1372 | ||
1369 | err = gen_new_estimator(&cl->bstats, &cl->rate_est, | 1373 | if (htb_rate_est || tca[TCA_RATE]) { |
1370 | qdisc_root_sleeping_lock(sch), | 1374 | err = gen_new_estimator(&cl->bstats, &cl->rate_est, |
1371 | tca[TCA_RATE] ? : &est.nla); | 1375 | qdisc_root_sleeping_lock(sch), |
1372 | if (err) { | 1376 | tca[TCA_RATE] ? : &est.nla); |
1373 | kfree(cl); | 1377 | if (err) { |
1374 | goto failure; | 1378 | kfree(cl); |
1379 | goto failure; | ||
1380 | } | ||
1375 | } | 1381 | } |
1376 | 1382 | ||
1377 | cl->refcnt = 1; | 1383 | cl->refcnt = 1; |