diff options
-rw-r--r-- | mm/oom_kill.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 423dcae323a5..991bf0cf4778 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -204,7 +204,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) | |||
204 | do_posix_clock_monotonic_gettime(&uptime); | 204 | do_posix_clock_monotonic_gettime(&uptime); |
205 | do_each_thread(g, p) { | 205 | do_each_thread(g, p) { |
206 | unsigned long points; | 206 | unsigned long points; |
207 | int releasing; | ||
208 | 207 | ||
209 | /* | 208 | /* |
210 | * skip kernel threads and tasks which have already released | 209 | * skip kernel threads and tasks which have already released |
@@ -226,16 +225,15 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) | |||
226 | * the process of exiting and releasing its resources. | 225 | * the process of exiting and releasing its resources. |
227 | * Otherwise we could get an OOM deadlock. | 226 | * Otherwise we could get an OOM deadlock. |
228 | */ | 227 | */ |
229 | releasing = test_tsk_thread_flag(p, TIF_MEMDIE) || | 228 | if ((p->flags & PF_EXITING) && p == current) { |
230 | p->flags & PF_EXITING; | 229 | chosen = p; |
231 | if (releasing) { | 230 | *ppoints = ULONG_MAX; |
232 | if (p->flags & PF_EXITING && p == current) { | 231 | break; |
233 | chosen = p; | ||
234 | *ppoints = ULONG_MAX; | ||
235 | break; | ||
236 | } | ||
237 | return ERR_PTR(-1UL); | ||
238 | } | 232 | } |
233 | if ((p->flags & PF_EXITING) || | ||
234 | test_tsk_thread_flag(p, TIF_MEMDIE)) | ||
235 | return ERR_PTR(-1UL); | ||
236 | |||
239 | if (p->oomkilladj == OOM_DISABLE) | 237 | if (p->oomkilladj == OOM_DISABLE) |
240 | continue; | 238 | continue; |
241 | 239 | ||
@@ -245,6 +243,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) | |||
245 | *ppoints = points; | 243 | *ppoints = points; |
246 | } | 244 | } |
247 | } while_each_thread(g, p); | 245 | } while_each_thread(g, p); |
246 | |||
248 | return chosen; | 247 | return chosen; |
249 | } | 248 | } |
250 | 249 | ||