Skip to content

Commit

Permalink
Fix a bug for ksoftirqd high cpu usage.
Browse files Browse the repository at this point in the history
sched: Add irq_{enter,exit}() to scheduler_ipi()

- patches.taobao/sched-fix-ksoftirqd-high-usage.patch:
  • Loading branch information
taoma-tm committed Nov 29, 2012
1 parent a444578 commit 1be3690
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel-source.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Nov 29 23:56:56 CST 2012 - [email protected]

Fix a bug for ksoftirqd high cpu usage.

sched: Add irq_{enter,exit}() to scheduler_ipi()

- patches.taobao/sched-fix-ksoftirqd-high-usage.patch:

-------------------------------------------------------------------
Thu Nov 29 14:23:11 CST 2012 - [email protected]

Expand Down
48 changes: 48 additions & 0 deletions patches.taobao/sched-fix-ksoftirqd-high-usage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From: Peter Zijlstra <[email protected]>
Subject: [PATCH] sched: Add irq_{enter,exit}() to scheduler_ipi()
Patch-mainline: v3.0-rc7-6-gc5d753a
References:

Commit ID: c5d753a55ac92e09816d410cd17093813f1a904b

Ensure scheduler_ipi() calls irq_{enter,exit} when it does some actual
work. Traditionally we never did any actual work from the resched IPI
and all magic happened in the return from interrupt path.

Now that we do do some work, we need to ensure irq_{enter,exit} are
called so that we don't confuse things.

This affects things like timekeeping, NO_HZ and RCU, basically
everything with a hook in irq_enter/exit.

Explicit examples of things going wrong are:

sched_clock_cpu() -- has a callback when leaving NO_HZ state to take
a new reading from GTOD and TSC. Without this
callback, time is stuck in the past.

RCU -- needs in_irq() to work in order to avoid some nasty deadlocks

Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Signed-off-by: Charles Wang <[email protected]>

Index: linux-2.6.32-279.2.1.el5/kernel/sched.c
===================================================================
--- linux-2.6.32-279.2.1.el5.orig/kernel/sched.c
+++ linux-2.6.32-279.2.1.el5/kernel/sched.c
@@ -2504,11 +2504,14 @@ void scheduler_ipi(void)
{
if (!got_nohz_idle_kick())
return;
+
+ irq_enter();
/*
* Check if someone kicked us for doing the nohz idle load balance.
*/
if (unlikely(got_nohz_idle_kick() && !need_resched()))
raise_softirq_irqoff(SCHED_SOFTIRQ);
+ irq_exit();
}

/***
1 change: 1 addition & 0 deletions series.conf
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ patches.taobao/block-throttle-Add-IO-throttled-information-in-blkcg.patch
patches.taobao/loadavg-bug-fix-001.patch
patches.taobao/loadavg-bug-fix-002.patch
patches.taobao/loadavg-bug-fix-003.patch
patches.taobao/sched-fix-ksoftirqd-high-usage.patch

# mm reclaim fix
patches.taobao/mm_forward_port_18_memory_management_algorithm.patch
Expand Down

0 comments on commit 1be3690

Please sign in to comment.