-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdont-reanimate-zombies.patch
73 lines (63 loc) · 2.17 KB
/
dont-reanimate-zombies.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From [email protected] Thu Apr 14 16:06:31 2005
Date: Thu, 14 Apr 2005 16:06:31 -0700
From: Jason Uhlenkott <[email protected]>
Subject: [PATCH] Fix schedule() to not reanimate zombies
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.6i
Status: RO
Content-Length: 1782
Lines: 58
If a task other than the one doing the dump calls schedule(), it's
forced to spin until the dump is complete and then return, which is
wrong if it's a zombie which was calling schedule() to switch itself
out for the last time. In that case we'll return back into do_exit()
and hit the BUG() near the bottom.
The fix is to spin until the dump is complete and then continue normal
processing of schedule() rather than just returning.
This is only a problem for nondisruptive dumps. In the disruptive
case, the dumping cpu will reset the machine without ever clearing
dump_oncpu, so the non-dumping tasks will never leave schedule().
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c 2005-04-14 15:02:34.145213372 -0700
+++ linux/kernel/sched.c 2005-04-14 15:04:11.505402921 -0700
@@ -2437,14 +2437,18 @@
unsigned long run_time;
int cpu, idx;
- /*
- * If crash dump is in progress, this other cpu's
- * need to wait until it completes.
- * NB: this code is optimized away for kernels without
- * dumping enabled.
+ /*
+ * If a crash dump is in progress, schedule()
+ * is a no-op for the dumping cpu, and all
+ * other cpus are forced to wait until the dump
+ * completes.
*/
if (unlikely(dump_oncpu))
- goto dump_scheduling_disabled;
+ if (dump_oncpu == smp_processor_id()+1)
+ return;
+ else
+ while (dump_oncpu)
+ cpu_relax();
/*
* Test if we are atomic. Since do_exit() needs to call into
@@ -2611,14 +2615,6 @@
goto need_resched;
return;
-
- dump_scheduling_disabled:
- /* allow scheduling only if this is the dumping cpu */
- if (dump_oncpu != smp_processor_id()+1) {
- while (dump_oncpu)
- cpu_relax();
- }
- return;
}
EXPORT_SYMBOL(schedule);