oom_reaper: missing parts
Subsystems (2)
cover oom_reaper: missing parts
Hi Andrew,
there are two following left overs which are missing in your tree right now. Could you add them please?
Thanks to Tetsuo for pointing it out http://lkml.kernel.org/r/[email protected]
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/2 mm-oom_reaper-report-success-failure-fix-fix
From: Michal Hocko <[email protected]>
typo fix
--- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/oom_kill.c +1 -1
@@ -480,7 +480,7 @@ static bool __oom_reap_task(struct task_struct *tsk) } }tlb_finish_mmu (&tlb,0 ,-1 ); - pr_info("oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lulB\n", + pr_info("oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n", task_pid_nr(tsk), tsk->comm, K(get_mm_counter(mm, MM_ANONPAGES)), K(get_mm_counter(mm, MM_FILEPAGES)),
Signature · 7 lines
2.7.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/2 oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
In reply to Michal HockoFrom: Michal Hocko <[email protected]>
fix a left over
Tetsuo Handa <[email protected]>
--- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/oom_kill.c +1 -1
@@ -569,7 +569,7 @@ static int __init oom_init(void) } subsys_initcall(oom_init)#else -static void wake_oom_reaper (struct task_struct *mm) +static void wake_oom_reaper (struct task_struct *tsk) { }#endif
Signature · 7 lines
2.7.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Michal Hocko
Hi Andrew,
there are two following left overs which are missing in your tree right now. Could you add them please?Thanks to Tetsuo for pointing it out http://lkml.kernel.org/r/[email protected]
And I failed to notice this was a private email.
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 2/2] oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
In reply to Michal HockoQuoted 15 lines · On Tue, 8 Mar 2016 14:12:17 +0100 Michal Hocko <[email protected]> wrote:
From: Michal Hocko <[email protected]>
fix a left over
Tetsuo Handa <[email protected]>
Signed-off-by Michal Hocko <[email protected]>--- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/oom_kill.c +0
-0
mm/oom_kill.c static int __init oom_init(void) · line 575
Quoted 8 lines
mm/oom_kill.c +1
-1@@ -569,7 +569,7 @@ static int __init oom_init(void) } subsys_initcall(oom_init)#else -static void wake_oom_reaper (struct task_struct *mm) +static void wake_oom_reaper (struct task_struct *tsk) { }#endif
Thanks.
I found the below patch lying around but I didn't queue it properly. Is it legit?
From: Johannes Weiner <[email protected]>
Subject: oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
When the OOM killer scans tasks and encounters a PF_EXITING one, it force-selects that one regardless of the score. Is there a possibility that the task might hang after it has set PF_EXITING? In that case the OOM killer should be able to move on to the next task.
Frankly, I don't even know why we check for exiting tasks in the OOM killer. We've tried direct reclaim at least 15 times by the time we decide the system is OOM, there was plenty of time to exit and free memory; and a task might exit voluntarily right after we issue a kill. This is testing pure noise.
---
mm/oom_kill.c | 3 --- 1 file changed, 3 deletions(-)
mm/oom_kill.c renamed from mm/oom_kill.c~oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix +0 -3
@@ -292,9 +292,6 @@ enum oom_scan_t oom_scan_process_thread(if (oom_task_origin (task))return OOM_SCAN_SELECT ; -if (task_will_free_mem (task) && !is_sysrq_oom (oc)) -return OOM_SCAN_ABORT ; -return OOM_SCAN_OK ; }
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2] oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
Quoted 2 lines · Andrew Morton
I found the below patch lying around but I didn't queue it properly. Is it legit?
I think that patch wants patch description updated. Not testing pure noise, but causing possible livelock.
http://lkml.kernel.org/r/[email protected]
Quoted 45 lines
From: Johannes Weiner <[email protected]>
Subject: oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fixWhen the OOM killer scans tasks and encounters a
PF_EXITINGone, it force-selects that one regardless of the score. Is there a possibility that the task might hang after it has setPF_EXITING? In that case the OOM killer should be able to move on to the next task.Frankly, I don't even know why we check for exiting tasks in the OOM killer. We've tried direct reclaim at least 15 times by the time we decide the system is OOM, there was plenty of time to exit and free memory; and a task might exit voluntarily right after we issue a kill. This is testing pure noise.
Cc Tetsuo Handa <[email protected]>Cc Michal Hocko <[email protected]>Cc Kirill A. Shutemov <[email protected]>Cc Mel Gorman <[email protected]>Cc David Rientjes <[email protected]>Cc Oleg Nesterov <[email protected]>Cc Hugh Dickins <[email protected]>Cc Andrea Argangeli <[email protected]>Cc Rik van Riel <[email protected]>Cc Sasha Levin <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
mm/oom_kill.c | 3 --- 1 file changed, 3 deletions(-)diff -puN
mm/oom_kill.c~oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fixmm/oom_kill.cmm/oom_kill.c renamed from mm/oom_kill.c~oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix +0
-3@@ -292,9 +292,6 @@ enum oom_scan_t oom_scan_process_thread(if (oom_task_origin (task))return OOM_SCAN_SELECT ; -if (task_will_free_mem (task) && !is_sysrq_oom (oc)) -return OOM_SCAN_ABORT ; -return OOM_SCAN_OK ; }
Quoted 3 lines
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2] oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
In reply to Andrew MortonQuoted 2 lines · Andrew Morton
I found the below patch lying around but I didn't queue it properly. Is it legit?
Yeah. Michal suggested this should be its own patch, which I agree with. The subject would then be:
Subject: mm: oom_kill: don't ignore oom score on exiting tasks
Quoted 8 lines
From: Johannes Weiner <[email protected]>
Subject: oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fixWhen the OOM killer scans tasks and encounters a
PF_EXITINGone, it force-selects that one regardless of the score. Is there a possibility that the task might hang after it has setPF_EXITING? In that case the OOM killer should be able to move on to the next task.
Quoted 5 lines
Frankly, I don't even know why we check for exiting tasks in the OOM killer. We've tried direct reclaim at least 15 times by the time we decide the system is OOM, there was plenty of time to exit and free memory; and a task might exit voluntarily right after we issue a kill. This is testing pure noise.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2] oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
In reply to Tetsuo HandaQuoted 7 lines · Tetsuo Handa
Quoted 2 lines · Andrew Morton
I found the below patch lying around but I didn't queue it properly. Is it legit?
I think that patch wants patch description updated. Not testing pure noise, but causing possible livelock.
http://lkml.kernel.org/r/[email protected]
Sorry, I completely missed that. We're drowning in OOM killer fixes!
However, I disagree with your changelog. The scenario you describe is real, but that the hung task is exiting is also noise. The underlying problem is that the OOM victim is hung. Instead of OOM_SCAN_ABORT, the OOM killer could also select some other non-exiting task that has the mmap_sem held for reading. This patch doesn't fix that bug.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 2/2] oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
Quoted 1 line · On Wed, 9 Mar 2016 17:48:29 -0500 Johannes Weiner <[email protected]> wrote:
However, I disagree with your changelog.
What text would you prefer?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2] oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Wed, 9 Mar 2016 17:48:29 -0500 Johannes Weiner <[email protected]> wrote:
However, I disagree with your changelog.
What text would you prefer?
I'd just keep the one you had initially. Or better, this modified version:
When the OOM killer scans tasks and encounters a PF_EXITING one, it force-selects that task regardless of the score. The problem is that if that task got stuck waiting for some state the allocation site is holding, the OOM reaper can not move on to the next best victim.
Frankly, I don't even know why we check for exiting tasks in the OOM killer. We've tried direct reclaim at least 15 times by the time we decide the system is OOM, there was plenty of time to exit and free memory; and a task might exit voluntarily right after we issue a kill. This is testing pure noise. Remove it.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2]oom-clear-tif_memdie-after-oom_reaper-managed-to-unmap-the-address-space-fix
Quoted 7 lines · Johannes Weiner
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Wed, 9 Mar 2016 17:48:29 -0500 Johannes Weiner <[email protected]> wrote:
However, I disagree with your changelog.
What text would you prefer?
Quoted 8 lines
I'd just keep the one you had initially. Or better, this modified version:
When the OOM killer scans tasks and encounters a
PF_EXITINGone, it force-selects that task regardless of the score. The problem is that if that task got stuck waiting for some state the allocation site is holding, the OOM reaper can not move on to the next best victim.
There is no guarantee that the OOM reaper is waken up. There are shortcuts which I don't like.
Quoted 6 lines
Frankly, I don't even know why we check for exiting tasks in the OOM killer. We've tried direct reclaim at least 15 times by the time we decide the system is OOM, there was plenty of time to exit and free memory; and a task might exit voluntarily right after we issue a kill. This is testing pure noise. Remove it.
My concern is what an optimistic idea it is to wait for task_will_free_mem() or TIF_MEMDIE task forever blindly
( http://lkml.kernel.org/r/[email protected] ). We have
do_exit() {
exit_signals(); /* sets PF_EXITING */
/* (1) start */
exit_mm() {
mm_release() {
exit_robust_list() {
get_user() {
__do_page_fault() {
/* (1) end */
down_read(¤t->mm->mmap_sem);
handle_mm_fault() {
kmalloc(GFP_KERNEL) {
out_of_memory() {
if (current->mm &&
(fatal_signal_pending(current) || task_will_free_mem(current))) {
mark_oom_victim(current); /* sets TIF_MEMDIE */
return true;
}
}
}
}
up_read(¤t->mm->mmap_sem);
/* (2) start */
}
}
}
}
/* (2) end */
down_read(¤t->mm->mmap_sem);
up_read(¤t->mm->mmap_sem);
current->mm = NULL;
exit_oom_victim();
}
}sequence. We will hit silent OOM livelock if somebody sharing the mm does down_write_killable(¤t->mm->mmap_sem) and kmalloc(GFP_KERNEL) for mmap() etc. at (1) or (2) due to failing to send SIGKILL to somebody doing/done down_write_killable(¤t->mm->mmap_sem) and returning OOM_SCAN_ABORT without testing whether down_read(&victim->mm->mmap_sem) will succeed. Since the OOM reaper is not invoked when shortcut is used, nobody can unlock.
Doing
- if (task_will_free_mem(task) && !is_sysrq_oom(oc))
+ if (task_will_free_mem(task) && !is_sysrq_oom(oc) && can_lock_mm_for_read(task))
return OOM_SCAN_ABORT;
and
if (test_tsk_thread_flag(task, TIF_MEMDIE)) {
- if (!is_sysrq_oom(oc))
+ if (!is_sysrq_oom(oc) && can_lock_mm_for_read(task))
return OOM_SCAN_ABORT;
}is a too fast decision because can_lock_mm_for_read(task) might become true if if we waited for a moment. Doing
- if (task_will_free_mem(task) && !is_sysrq_oom(oc))
+ if (task_will_free_mem(task) && !is_sysrq_oom(oc) && we_havent_waited_enough_period(task))
return OOM_SCAN_ABORT;
and
if (test_tsk_thread_flag(task, TIF_MEMDIE)) {
- if (!is_sysrq_oom(oc))
+ if (!is_sysrq_oom(oc) && we_havent_waited_enough_period(task))
return OOM_SCAN_ABORT;
}is a timeout based unlocking which Michal does not like. Doing
- if (task_will_free_mem(task) && !is_sysrq_oom(oc))
+ if (task_will_free_mem(task) && !is_sysrq_oom(oc) && should_oom_scan_abort(task))
return OOM_SCAN_ABORT;
and
if (test_tsk_thread_flag(task, TIF_MEMDIE)) {
- if (!is_sysrq_oom(oc))
+ if (!is_sysrq_oom(oc) && should_oom_scan_abort(task))
return OOM_SCAN_ABORT;
}is a counter based unlocking which I don't know what Michal thinks.
This situation is similar to when to declare OOM in OOM detection rework.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>