diff options
author | Michal Hocko <mhocko@suse.com> | 2016-03-25 17:20:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-25 19:37:42 -0400 |
commit | bc448e897b6d24aae32701763b8a1fe15d29fa26 (patch) | |
tree | 3c91d6fe4fc3b35671b0356c6bdc39d8b3793f71 /mm | |
parent | 36324a990cf578b57828c04cd85ac62cd25cf5a4 (diff) |
mm, oom_reaper: report success/failure
Inform about the successful/failed oom_reaper attempts and dump all the
held locks to tell us more who is blocking the progress.
[akpm@linux-foundation.org: fix CONFIG_MMU=n build]
Signed-off-by: Michal Hocko <mhocko@suse.com>
Cc: Andrea Argangeli <andrea@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/oom_kill.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 2830b1c6483e..30a60991173a 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -410,6 +410,8 @@ static DECLARE_WAIT_QUEUE_HEAD(oom_victims_wait); | |||
410 | 410 | ||
411 | bool oom_killer_disabled __read_mostly; | 411 | bool oom_killer_disabled __read_mostly; |
412 | 412 | ||
413 | #define K(x) ((x) << (PAGE_SHIFT-10)) | ||
414 | |||
413 | #ifdef CONFIG_MMU | 415 | #ifdef CONFIG_MMU |
414 | /* | 416 | /* |
415 | * OOM Reaper kernel thread which tries to reap the memory used by the OOM | 417 | * OOM Reaper kernel thread which tries to reap the memory used by the OOM |
@@ -479,6 +481,11 @@ static bool __oom_reap_task(struct task_struct *tsk) | |||
479 | &details); | 481 | &details); |
480 | } | 482 | } |
481 | tlb_finish_mmu(&tlb, 0, -1); | 483 | tlb_finish_mmu(&tlb, 0, -1); |
484 | pr_info("oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n", | ||
485 | task_pid_nr(tsk), tsk->comm, | ||
486 | K(get_mm_counter(mm, MM_ANONPAGES)), | ||
487 | K(get_mm_counter(mm, MM_FILEPAGES)), | ||
488 | K(get_mm_counter(mm, MM_SHMEMPAGES))); | ||
482 | up_read(&mm->mmap_sem); | 489 | up_read(&mm->mmap_sem); |
483 | 490 | ||
484 | /* | 491 | /* |
@@ -495,14 +502,21 @@ out: | |||
495 | return ret; | 502 | return ret; |
496 | } | 503 | } |
497 | 504 | ||
505 | #define MAX_OOM_REAP_RETRIES 10 | ||
498 | static void oom_reap_task(struct task_struct *tsk) | 506 | static void oom_reap_task(struct task_struct *tsk) |
499 | { | 507 | { |
500 | int attempts = 0; | 508 | int attempts = 0; |
501 | 509 | ||
502 | /* Retry the down_read_trylock(mmap_sem) a few times */ | 510 | /* Retry the down_read_trylock(mmap_sem) a few times */ |
503 | while (attempts++ < 10 && !__oom_reap_task(tsk)) | 511 | while (attempts++ < MAX_OOM_REAP_RETRIES && !__oom_reap_task(tsk)) |
504 | schedule_timeout_idle(HZ/10); | 512 | schedule_timeout_idle(HZ/10); |
505 | 513 | ||
514 | if (attempts > MAX_OOM_REAP_RETRIES) { | ||
515 | pr_info("oom_reaper: unable to reap pid:%d (%s)\n", | ||
516 | task_pid_nr(tsk), tsk->comm); | ||
517 | debug_show_all_locks(); | ||
518 | } | ||
519 | |||
506 | /* Drop a reference taken by wake_oom_reaper */ | 520 | /* Drop a reference taken by wake_oom_reaper */ |
507 | put_task_struct(tsk); | 521 | put_task_struct(tsk); |
508 | } | 522 | } |
@@ -649,7 +663,6 @@ static bool process_shares_mm(struct task_struct *p, struct mm_struct *mm) | |||
649 | return false; | 663 | return false; |
650 | } | 664 | } |
651 | 665 | ||
652 | #define K(x) ((x) << (PAGE_SHIFT-10)) | ||
653 | /* | 666 | /* |
654 | * Must be called while holding a reference to p, which will be released upon | 667 | * Must be called while holding a reference to p, which will be released upon |
655 | * returning. | 668 | * returning. |