Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 376914
b: refs/heads/master
c: 34376a5
h: refs/heads/master
v: v3
  • Loading branch information
Ben Greear authored and Linus Torvalds committed Jun 11, 2013
1 parent 9406017 commit a02db0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1b79821fe7855c34030bc2f177660874e0a0ab62
refs/heads/master: 34376a50fb1fa095b9d0636fa41ed2e73125f214
13 changes: 10 additions & 3 deletions trunk/kernel/softirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,20 @@ void local_bh_enable_ip(unsigned long ip)
EXPORT_SYMBOL(local_bh_enable_ip);

/*
* We restart softirq processing for at most 2 ms,
* and if need_resched() is not set.
* We restart softirq processing for at most MAX_SOFTIRQ_RESTART times,
* but break the loop if need_resched() is set or after 2 ms.
* The MAX_SOFTIRQ_TIME provides a nice upper bound in most cases, but in
* certain cases, such as stop_machine(), jiffies may cease to
* increment and so we need the MAX_SOFTIRQ_RESTART limit as
* well to make sure we eventually return from this method.
*
* These limits have been established via experimentation.
* The two things to balance is latency against fairness -
* we want to handle softirqs as soon as possible, but they
* should not be able to lock up the box.
*/
#define MAX_SOFTIRQ_TIME msecs_to_jiffies(2)
#define MAX_SOFTIRQ_RESTART 10

asmlinkage void __do_softirq(void)
{
Expand All @@ -212,6 +217,7 @@ asmlinkage void __do_softirq(void)
unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
int cpu;
unsigned long old_flags = current->flags;
int max_restart = MAX_SOFTIRQ_RESTART;

/*
* Mask out PF_MEMALLOC s current task context is borrowed for the
Expand Down Expand Up @@ -265,7 +271,8 @@ asmlinkage void __do_softirq(void)

pending = local_softirq_pending();
if (pending) {
if (time_before(jiffies, end) && !need_resched())
if (time_before(jiffies, end) && !need_resched() &&
--max_restart)
goto restart;

wakeup_softirqd();
Expand Down

0 comments on commit a02db0c

Please sign in to comment.