* [PATCH net-next] net_sched: htb: do not setup default rate estimators
@ 2013-06-06 21:53 Eric Dumazet
2013-06-12 7:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2013-06-06 21:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
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>
---
Google-Bug-Id: 9316866
net/sched/sch_htb.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index adaedd7..d0ee132 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
module_param (htb_hysteresis, int, 0640);
MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate");
+static int htb_rate_est = 0; /* htb classes have a default rate estimator */
+module_param(htb_rate_est, int, 0640);
+MODULE_PARM_DESC(htb_rate_est, "setup a default rate estimator (4sec 16sec) for htb classes");
+
/* used internaly to keep status of single class */
enum htb_cmode {
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,
if (!cl)
goto failure;
- err = gen_new_estimator(&cl->bstats, &cl->rate_est,
- qdisc_root_sleeping_lock(sch),
- tca[TCA_RATE] ? : &est.nla);
- if (err) {
- kfree(cl);
- goto failure;
+ if (htb_rate_est || tca[TCA_RATE]) {
+ err = gen_new_estimator(&cl->bstats, &cl->rate_est,
+ qdisc_root_sleeping_lock(sch),
+ tca[TCA_RATE] ? : &est.nla);
+ if (err) {
+ kfree(cl);
+ goto failure;
+ }
}
cl->refcnt = 1;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net_sched: htb: do not setup default rate estimators
2013-06-06 21:53 [PATCH net-next] net_sched: htb: do not setup default rate estimators Eric Dumazet
@ 2013-06-12 7:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-06-12 7:14 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 06 Jun 2013 14:53:16 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> 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>
Fair enough, applied, let's see if anyone complains.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-12 7:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-06 21:53 [PATCH net-next] net_sched: htb: do not setup default rate estimators Eric Dumazet
2013-06-12 7:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).