lkml.org 
[lkml]   [2020]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] sched: mark PRINTK_DEFERRED_CONTEXT_MASK in __schedule()
Date
The WARN_ON/WARN_ON_ONCE with rq lock held in __schedule() should be
deferred by marking the PRINTK_DEFERRED_CONTEXT_MASK, or will cause
deadlock on rq lock in the printk path.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
kernel/sched/core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2d95dc3f4644..81d8bf614225 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4444,6 +4444,7 @@ static void __sched notrace __schedule(bool preempt)
*/
rq_lock(rq, &rf);
smp_mb__after_spinlock();
+ printk_deferred_enter();

/* Promote REQ to ACT */
rq->clock_update_flags <<= 1;
@@ -4530,6 +4531,7 @@ static void __sched notrace __schedule(bool preempt)
rq_unlock_irq(rq, &rf);
}

+ printk_deferred_exit();
balance_callback(rq);
}

--
2.11.0
\
 
 \ /
  Last update: 2020-09-27 18:12    [W:0.071 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site