summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaesar Wang <wxt@rock-chips.com>2016-08-23 11:47:02 +0100
committerAmit Pundir <amit.pundir@linaro.org>2016-10-12 17:34:22 +0530
commitca4b83c5476f68cb0ead77c23775e7ef68a37058 (patch)
tree25acea169ba7c2b72a62118db95b50f83e61d1d6
parent31f42471b16e432323c92d038836039b088730c3 (diff)
sched/fair: remove printk while schedule is in progress
It will cause deadlock and while(1) if call printk while schedule is in progress. The block state like as below: cpu0(hold the console sem): printk->console_unlock->up_sem->spin_lock(&sem->lock)->wake_up_process(cpu1) ->try_to_wake_up(cpu1)->while(p->on_cpu). cpu1(request console sem): console_lock->down_sem->schedule->idle_banlance->update_cpu_capacity-> printk->console_trylock->spin_lock(&sem->lock). p->on_cpu will be 1 forever, because the task is still running on cpu1, so cpu0 is blocked in while(p->on_cpu), but cpu1 could not get spin_lock(&sem->lock), it is blocked too, it means the task will running on cpu1 forever. Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-rw-r--r--kernel/sched/fair.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 14c06f92184c..30d76a18ae1a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7125,7 +7125,8 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu)
mcc->cpu = cpu;
#ifdef CONFIG_SCHED_DEBUG
raw_spin_unlock_irqrestore(&mcc->lock, flags);
- pr_info("CPU%d: update max cpu_capacity %lu\n", cpu, capacity);
+ printk_deferred(KERN_INFO "CPU%d: update max cpu_capacity %lu\n",
+ cpu, capacity);
goto skip_unlock;
#endif
}