Skip to content

Commit

Permalink
[PATCH] sched: relax pinned balancing
Browse files Browse the repository at this point in the history
The maximum rebalance interval allowed by the multiprocessor balancing
backoff is often not large enough to handle corner cases where there are
lots of tasks pinned on a CPU.  Suresh reported:

	I see system livelock's if for example I have 7000 processes
	pinned onto one cpu (this is on the fastest 8-way system I
	have access to).

After this patch, the machine is reported to go well above this number.

Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Jun 25, 2005
1 parent 476d139 commit 77391d7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,12 @@ static runqueue_t *find_busiest_queue(struct sched_group *group)
return busiest;
}

/*
* Max backoff if we encounter pinned tasks. Pretty arbitrary value, but
* so long as it is large enough.
*/
#define MAX_PINNED_INTERVAL 512

/*
* Check this_cpu to ensure it is balanced within domain. Attempt to move
* tasks if there is an imbalance.
Expand All @@ -2042,7 +2048,7 @@ static int load_balance(int this_cpu, runqueue_t *this_rq,
struct sched_group *group;
runqueue_t *busiest;
unsigned long imbalance;
int nr_moved, all_pinned;
int nr_moved, all_pinned = 0;
int active_balance = 0;

spin_lock(&this_rq->lock);
Expand Down Expand Up @@ -2133,7 +2139,8 @@ static int load_balance(int this_cpu, runqueue_t *this_rq,

sd->nr_balance_failed = 0;
/* tune up the balancing interval */
if (sd->balance_interval < sd->max_interval)
if ((all_pinned && sd->balance_interval < MAX_PINNED_INTERVAL) ||
(sd->balance_interval < sd->max_interval))
sd->balance_interval *= 2;

return 0;
Expand Down

0 comments on commit 77391d7

Please sign in to comment.