remarkable-linux/net/sched
Venkatesh Pallipadi 75e1056f5c sched: Fix softirq time accounting
Peter Zijlstra found a bug in the way softirq time is accounted in
VIRT_CPU_ACCOUNTING on this thread:

   http://lkml.indiana.edu/hypermail//linux/kernel/1009.2/01366.html

The problem is, softirq processing uses local_bh_disable internally. There
is no way, later in the flow, to differentiate between whether softirq is
being processed or is it just that bh has been disabled. So, a hardirq when bh
is disabled results in time being wrongly accounted as softirq.

Looking at the code a bit more, the problem exists in !VIRT_CPU_ACCOUNTING
as well. As account_system_time() in normal tick based accouting also uses
softirq_count, which will be set even when not in softirq with bh disabled.

Peter also suggested solution of using 2*SOFTIRQ_OFFSET as irq count
for local_bh_{disable,enable} and using just SOFTIRQ_OFFSET while softirq
processing. The patch below does that and adds API in_serving_softirq() which
returns whether we are currently processing softirq or not.

Also changes one of the usages of softirq_count in net/sched/cls_cgroup.c
to in_serving_softirq.

Looks like many usages of in_softirq really want in_serving_softirq. Those
changes can be made individually on a case by case basis.

Signed-off-by: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1286237003-12406-2-git-send-email-venki@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-10-18 20:52:20 +02:00
..
act_api.c pkt_sched: gen_kill_estimator() rcu fixes 2010-06-11 18:37:08 -07:00
act_gact.c net sched: fix some kernel memory leaks 2010-08-17 15:12:15 -07:00
act_ipt.c net sched: printk message severity 2010-05-17 23:23:12 -07:00
act_mirred.c net sched: fix some kernel memory leaks 2010-08-17 15:12:15 -07:00
act_nat.c net sched: fix some kernel memory leaks 2010-08-17 15:12:15 -07:00
act_pedit.c net sched: make pedit check for clones instead 2010-06-07 01:10:43 -07:00
act_police.c net sched: fix kernel leak in act_police 2010-09-01 14:29:34 -07:00
act_simple.c net sched: fix some kernel memory leaks 2010-08-17 15:12:15 -07:00
act_skbedit.c net sched: fix some kernel memory leaks 2010-08-17 15:12:15 -07:00
cls_api.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-04-11 14:53:53 -07:00
cls_basic.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cls_cgroup.c sched: Fix softirq time accounting 2010-10-18 20:52:20 +02:00
cls_flow.c cls_flow: add sanity check for the packet length 2010-08-04 21:53:15 -07:00
cls_fw.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cls_route.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cls_rsvp.c
cls_rsvp.h cls_rsvp: add sanity check for the packet length 2010-08-04 21:53:15 -07:00
cls_rsvp6.c
cls_tcindex.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cls_u32.c cls_u32: signedness bug 2010-10-05 00:40:39 -07:00
em_cmp.c net: em_cmp.c use unaligned access helpers 2008-09-22 19:20:51 -07:00
em_meta.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
em_nbyte.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
em_text.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
em_u32.c [PKT_SCHED]: annotate cls_u32 2008-03-17 22:46:46 -07:00
ematch.c net sched: printk message severity 2010-05-17 23:23:12 -07:00
Kconfig cgroups: net_cls as module 2010-03-23 13:06:14 -07:00
Makefile net_sched: add classful multiqueue dummy scheduler 2009-09-06 02:07:05 -07:00
sch_api.c pkt_sched: Check .walk and .leaf class handlers 2010-08-11 01:37:00 -07:00
sch_atm.c sch_atm: Fix potential NULL deref. 2010-09-12 11:56:44 -07:00
sch_blackhole.c pkt_sched: Add qdisc->ops->peek() implementation. 2008-10-31 00:45:55 -07:00
sch_cbq.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sch_drr.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sch_dsmark.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sch_fifo.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sch_generic.c net: this_cpu_xxx conversions 2010-07-19 15:12:51 -07:00
sch_gred.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sch_hfsc.c net/sched/sch_hfsc.c: initialize parent's cl_cfmin properly in init_vf() 2010-09-01 14:29:35 -07:00
sch_htb.c htb: remove two unnecessary assignments 2010-06-07 01:08:11 -07:00
sch_ingress.c net: Remove unnecessary returns from void function()s 2010-05-17 23:23:14 -07:00
sch_mq.c net: Remove unnecessary returns from void function()s 2010-05-17 23:23:14 -07:00
sch_multiq.c net: Remove unnecessary returns from void function()s 2010-05-17 23:23:14 -07:00
sch_netem.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sch_prio.c net: Remove unnecessary returns from void function()s 2010-05-17 23:23:14 -07:00
sch_red.c net: Remove unnecessary returns from void function()s 2010-05-17 23:23:14 -07:00
sch_sfq.c pkt_sched: Fix sch_sfq vs tc_modify_qdisc oops 2010-08-11 01:36:59 -07:00
sch_tbf.c net: Use NET_XMIT_SUCCESS where possible. 2010-08-10 02:51:11 -07:00
sch_teql.c net: Use NET_XMIT_SUCCESS where possible. 2010-08-10 02:51:11 -07:00