summaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-30 13:06:47 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-30 13:06:47 -0800
commit9bd062d9eaf9e790330f37d9f4518e1b95131f6c (patch)
treea209a707eddf645bdeed3e9c82603ead64eea515 /kernel/sched.c
parent72244c0e68dd664b894adb34a8772a6e4673b4c1 (diff)
parentaf6d596fd603219b054c1c90fb16672a9fd441bd (diff)
downloadop-kernel-dev-9bd062d9eaf9e790330f37d9f4518e1b95131f6c.zip
op-kernel-dev-9bd062d9eaf9e790330f37d9f4518e1b95131f6c.tar.gz
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: sched: prevent divide by zero error in cpu_avg_load_per_task, update sched, cpusets: fix warning in kernel/cpuset.c sched: prevent divide by zero error in cpu_avg_load_per_task
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 9b1e793..b7480fb 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1453,9 +1453,10 @@ static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd);
static unsigned long cpu_avg_load_per_task(int cpu)
{
struct rq *rq = cpu_rq(cpu);
+ unsigned long nr_running = ACCESS_ONCE(rq->nr_running);
- if (rq->nr_running)
- rq->avg_load_per_task = rq->load.weight / rq->nr_running;
+ if (nr_running)
+ rq->avg_load_per_task = rq->load.weight / nr_running;
else
rq->avg_load_per_task = 0;
OpenPOWER on IntegriCloud