public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: reset sched_entity depth on changing parent
@ 2014-10-24 15:07 Burke Libbey
  2014-10-24 15:58 ` Peter Zijlstra
  0 siblings, 1 reply; 12+ messages in thread
From: Burke Libbey @ 2014-10-24 15:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, peterz

[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]

From 2014-02-15: https://lkml.org/lkml/2014/2/15/217

This issue was reported and patched, but it still occurs in some situations on
newer kernel versions.

[2249353.328452] BUG: unable to handle kernel NULL pointer dereference at 0000000000000150
[2249353.336528] IP: [<ffffffff810b1cf7>] check_preempt_wakeup+0xe7/0x210

se.parent gets out of sync with se.depth, causing a panic when the algorithm in
find_matching_se assumes they are correct. This patch forces se.depth to be
updated every time se.parent is, so they can no longer become desync'd.

CC: Ingo Molnar <mingo@kernel.org>
CC: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
---

I haven't been able to isolate the problem. Though I'm pretty confident this
fixes the issue I've been having, I have not been able to prove it.

I kept a debugging journal if you want more context for whatever reason:
https://gist.github.com/burke/c60dc5b8f0ba9bfd9275

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 24156c84..bcffba2 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -844,6 +844,7 @@ static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
 #ifdef CONFIG_FAIR_GROUP_SCHED
  p->se.cfs_rq = tg->cfs_rq[cpu];
  p->se.parent = tg->se[cpu];
+ p->se.depth = p->se.parent ? p->se.parent->depth + 1 : 0;
 #endif
 
 #ifdef CONFIG_RT_GROUP_SCHED


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-10-27 13:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 15:07 [PATCH] sched: reset sched_entity depth on changing parent Burke Libbey
2014-10-24 15:58 ` Peter Zijlstra
2014-10-24 17:18   ` Kirill Tkhai
2014-10-27  9:49     ` Kirill Tkhai
2014-10-27 12:07     ` Peter Zijlstra
2014-10-27 12:40       ` Tejun Heo
2014-10-27 13:28         ` Peter Zijlstra
2014-10-27 13:36           ` Kirill Tkhai
2014-10-27 13:45             ` Peter Zijlstra
2014-10-27 13:48               ` Kirill Tkhai
2014-10-27 13:47           ` Tejun Heo
2014-10-27 13:48             ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox