Repository navigation
Commit 83dbbdb
android, lowmemorykiller: remove task handoff notifier
The task handoff notifier leaks task_struct since it never gets freed
after the callback returns NOTIFY_OK, which means it is responsible for
doing so.
It turns out the lowmemorykiller actually doesn't need this notifier at
all. It's used to prevent unnecessary killing by waiting for a thread
to exit as a result of lowmem_shrink(), however, it's possible to do
this in the same way the kernel oom killer works by setting TIF_MEMDIE
and avoid killing if we're still waiting for it to exit.
The kernel oom killer will already automatically set TIF_MEMDIE for
threads that are attempting to allocate memory that have a fatal signal.
The thread selected by lowmem_shrink() will have such a signal after the
lowmemorykiller sends it a SIGKILL, so this won't result in an
unnecessary use of memory reserves for the thread to exit.
This has the added benefit that we don't have to rely on
CONFIG_PROFILING to prevent needlessly killing tasks.
Reported-by: Werner Landgraf <w.landgraf@ru.ru>
Cc: stable@vger.kernel.org
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 0034102 commit 83dbbdb
1 file changed
Lines changed: 7 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| |||
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | 66 | | |
86 | 67 | | |
87 | 68 | | |
| |||
97 | 78 | | |
98 | 79 | | |
99 | 80 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 81 | | |
114 | 82 | | |
115 | 83 | | |
| |||
148 | 116 | | |
149 | 117 | | |
150 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
151 | 125 | | |
152 | 126 | | |
153 | 127 | | |
| |||
174 | 148 | | |
175 | 149 | | |
176 | 150 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | 151 | | |
184 | | - | |
185 | 152 | | |
| 153 | + | |
186 | 154 | | |
187 | 155 | | |
188 | 156 | | |
| |||
198 | 166 | | |
199 | 167 | | |
200 | 168 | | |
201 | | - | |
202 | 169 | | |
203 | 170 | | |
204 | 171 | | |
205 | 172 | | |
206 | 173 | | |
207 | 174 | | |
208 | 175 | | |
209 | | - | |
210 | 176 | | |
211 | 177 | | |
212 | 178 | | |
| |||
0 commit comments