]> git.baikalelectronics.ru Git - kernel.git/commit
net_sched: avoid too many hrtimer_start() calls
authorEric Dumazet <edumazet@google.com>
Mon, 23 May 2016 21:24:56 +0000 (14:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 May 2016 21:49:14 +0000 (14:49 -0700)
commitad4f6f789dd731998a1365780ce3423eeb083c1a
tree20ab7182ee4b4fef2afebd14c960c0a3d9920c56
parent863bfe79a84539546e36ff6739fabcb5a39ae949
net_sched: avoid too many hrtimer_start() calls

I found a serious performance bug in packet schedulers using hrtimers.

sch_htb and sch_fq are definitely impacted by this problem.

We constantly rearm high resolution timers if some packets are throttled
in one (or more) class, and other packets are flying through qdisc on
another (non throttled) class.

hrtimer_start() does not have the mod_timer() trick of doing nothing if
expires value does not change :

if (timer_pending(timer) &&
            timer->expires == expires)
                return 1;

This issue is particularly visible when multiple cpus can queue/dequeue
packets on the same qdisc, as hrtimer code has to lock a remote base.

I used following fix :

1) Change htb to use qdisc_watchdog_schedule_ns() instead of open-coding
it.

2) Cache watchdog prior expiration. hrtimer might provide this, but I
prefer to not rely on some hrtimer internal.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/pkt_sched.h
net/sched/sch_api.c
net/sched/sch_htb.c