Re: [RFC][PATCH 00/16] sched: Core scheduling
From: Subhra Mazumdar
Date: Mon Mar 11 2019 - 19:36:23 EST
On 3/11/19 11:34 AM, Subhra Mazumdar wrote:
On 3/10/19 9:23 PM, Aubrey Li wrote:
On Sat, Mar 9, 2019 at 3:50 AM Subhra Mazumdar
<subhra.mazumdar@xxxxxxxxxx> wrote:
expected. Most of the performance recovery happens in patch 15 which,
unfortunately, is also the one that introduces the hard lockup.
After applied Subhra's patch, the following is triggered by enabling
core sched when a cgroup is
under heavy load.
It seems you are facing some other deadlock where printk is involved.
Can you
drop the last patch (patch 16 sched: Debug bits...) and try?
Thanks,
Subhra
Never Mind, I am seeing the same lockdep deadlock output even w/o patch
16. Btw
the NULL fix had something missing, following works.
--------->8------------
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1d0dac4..27cbc64 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4131,7 +4131,7 @@ pick_next_entity(struct cfs_rq *cfs_rq, struct
sched_entity *curr)
ÂÂÂÂÂÂÂÂ * Avoid running the skip buddy, if running something else can
ÂÂÂÂÂÂÂÂ * be done without getting too unfair.
*/
-ÂÂÂÂÂÂ if (cfs_rq->skip == se) {
+ÂÂÂÂÂÂ if (cfs_rq->skip && cfs_rq->skip == se) {
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ struct sched_entity *second;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (se == curr) {
@@ -4149,13 +4149,15 @@ pick_next_entity(struct cfs_rq *cfs_rq, struct
sched_entity *curr)
/*
ÂÂÂÂÂÂÂÂ * Prefer last buddy, try to return the CPU to a preempted task.
*/
-ÂÂÂÂÂÂ if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, left) < 1)
+ÂÂÂÂÂÂ if (left && cfs_rq->last && wakeup_preempt_entity(cfs_rq->last,
left)
+ÂÂÂÂÂÂÂÂÂÂ < 1)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ se = cfs_rq->last;
/*
ÂÂÂÂÂÂÂÂ * Someone really wants this to run. If it's not unfair, run it.
*/
-ÂÂÂÂÂÂ if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1)
+ÂÂÂÂÂÂ if (left && cfs_rq->next && wakeup_preempt_entity(cfs_rq->next,
left)
+ÂÂÂÂÂÂÂÂÂÂ < 1)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ se = cfs_rq->next;
ÂÂÂÂÂÂÂ clear_buddies(cfs_rq, se);
@@ -6958,6 +6960,9 @@ pick_task_fair(struct rq *rq)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ se = pick_next_entity(cfs_rq, NULL);
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (!(se || curr))
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ return NULL;
+
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (curr) {
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (se && curr->on_rq)
update_curr(cfs_rq);