* [PATCH 0/2] oom: Fix two critical bug in 2.6.36-rc1 @ 2010-08-19 10:52 KOSAKI Motohiro 2010-08-19 10:53 ` [PATCH 1/2] oom: fix NULL pointer dereference KOSAKI Motohiro 2010-08-19 10:54 ` [PATCH 2/2] oom: fix tasklist_lock leak KOSAKI Motohiro 0 siblings, 2 replies; 9+ messages in thread From: KOSAKI Motohiro @ 2010-08-19 10:52 UTC (permalink / raw) To: LKML, linux-mm, Andrew Morton, David Rientjes, Linus Torvalds, KAMEZAWA Hiroyuki Cc: kosaki.motohiro Currently, System is frequently crash when oom-killer was invoked because recent changes makes two critical regression. This patches fix them. I hope this series will be merged rapidly because they are preventing almost all oom testing. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] oom: fix NULL pointer dereference 2010-08-19 10:52 [PATCH 0/2] oom: Fix two critical bug in 2.6.36-rc1 KOSAKI Motohiro @ 2010-08-19 10:53 ` KOSAKI Motohiro 2010-08-19 15:29 ` Minchan Kim ` (2 more replies) 2010-08-19 10:54 ` [PATCH 2/2] oom: fix tasklist_lock leak KOSAKI Motohiro 1 sibling, 3 replies; 9+ messages in thread From: KOSAKI Motohiro @ 2010-08-19 10:53 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, David Rientjes, Linus Torvalds, KAMEZAWA Hiroyuki commit b940fd7035 (oom: remove unnecessary code and cleanup) added unnecessary NULL pointer dereference. remove it. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> --- mm/oom_kill.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 5014e50..17d48a6 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -401,10 +401,9 @@ static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order, static int oom_kill_task(struct task_struct *p, struct mem_cgroup *mem) { p = find_lock_task_mm(p); - if (!p) { - task_unlock(p); + if (!p) return 1; - } + pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB\n", task_pid_nr(p), p->comm, K(p->mm->total_vm), K(get_mm_counter(p->mm, MM_ANONPAGES)), -- 1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] oom: fix NULL pointer dereference 2010-08-19 10:53 ` [PATCH 1/2] oom: fix NULL pointer dereference KOSAKI Motohiro @ 2010-08-19 15:29 ` Minchan Kim 2010-08-19 20:35 ` David Rientjes 2010-08-19 23:50 ` KAMEZAWA Hiroyuki 2 siblings, 0 replies; 9+ messages in thread From: Minchan Kim @ 2010-08-19 15:29 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, David Rientjes, Linus Torvalds, KAMEZAWA Hiroyuki On Thu, Aug 19, 2010 at 07:53:31PM +0900, KOSAKI Motohiro wrote: > commit b940fd7035 (oom: remove unnecessary code and cleanup) added > unnecessary NULL pointer dereference. remove it. > > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> -- Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] oom: fix NULL pointer dereference 2010-08-19 10:53 ` [PATCH 1/2] oom: fix NULL pointer dereference KOSAKI Motohiro 2010-08-19 15:29 ` Minchan Kim @ 2010-08-19 20:35 ` David Rientjes 2010-08-19 23:50 ` KAMEZAWA Hiroyuki 2 siblings, 0 replies; 9+ messages in thread From: David Rientjes @ 2010-08-19 20:35 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, Linus Torvalds, KAMEZAWA Hiroyuki On Thu, 19 Aug 2010, KOSAKI Motohiro wrote: > commit b940fd7035 (oom: remove unnecessary code and cleanup) added > unnecessary NULL pointer dereference. remove it. > > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: David Rientjes <rientjes@google.com> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] oom: fix NULL pointer dereference 2010-08-19 10:53 ` [PATCH 1/2] oom: fix NULL pointer dereference KOSAKI Motohiro 2010-08-19 15:29 ` Minchan Kim 2010-08-19 20:35 ` David Rientjes @ 2010-08-19 23:50 ` KAMEZAWA Hiroyuki 2 siblings, 0 replies; 9+ messages in thread From: KAMEZAWA Hiroyuki @ 2010-08-19 23:50 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, David Rientjes, Linus Torvalds On Thu, 19 Aug 2010 19:53:31 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote: > commit b940fd7035 (oom: remove unnecessary code and cleanup) added > unnecessary NULL pointer dereference. remove it. > > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] oom: fix tasklist_lock leak 2010-08-19 10:52 [PATCH 0/2] oom: Fix two critical bug in 2.6.36-rc1 KOSAKI Motohiro 2010-08-19 10:53 ` [PATCH 1/2] oom: fix NULL pointer dereference KOSAKI Motohiro @ 2010-08-19 10:54 ` KOSAKI Motohiro 2010-08-19 16:05 ` Minchan Kim ` (2 more replies) 1 sibling, 3 replies; 9+ messages in thread From: KOSAKI Motohiro @ 2010-08-19 10:54 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, David Rientjes, Linus Torvalds, KAMEZAWA Hiroyuki commit 0aad4b3124 (oom: fold __out_of_memory into out_of_memory) introduced tasklist_lock leak. Then it caused following obvious danger warings and panic. ================================================ [ BUG: lock held when returning to user space! ] ------------------------------------------------ rsyslogd/1422 is leaving the kernel with locks still held! 1 lock held by rsyslogd/1422: #0: (tasklist_lock){.+.+.+}, at: [<ffffffff810faf64>] out_of_memory+0x164/0x3f0 BUG: scheduling while atomic: rsyslogd/1422/0x00000002 INFO: lockdep is turned off. This patch fixes it. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> --- mm/oom_kill.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 17d48a6..c48c5ef 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -646,6 +646,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, unsigned long freed = 0; unsigned int points; enum oom_constraint constraint = CONSTRAINT_NONE; + int killed = 0; blocking_notifier_call_chain(&oom_notify_list, 0, &freed); if (freed > 0) @@ -683,7 +684,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, if (!oom_kill_process(current, gfp_mask, order, 0, totalpages, NULL, nodemask, "Out of memory (oom_kill_allocating_task)")) - return; + goto out; } retry: @@ -691,7 +692,7 @@ retry: constraint == CONSTRAINT_MEMORY_POLICY ? nodemask : NULL); if (PTR_ERR(p) == -1UL) - return; + goto out; /* Found nothing?!?! Either we hang forever, or we panic. */ if (!p) { @@ -703,13 +704,15 @@ retry: if (oom_kill_process(p, gfp_mask, order, points, totalpages, NULL, nodemask, "Out of memory")) goto retry; + killed = 1; +out: read_unlock(&tasklist_lock); /* * Give "p" a good chance of killing itself before we * retry to allocate memory unless "p" is current */ - if (!test_thread_flag(TIF_MEMDIE)) + if (killed && !test_thread_flag(TIF_MEMDIE)) schedule_timeout_uninterruptible(1); } -- 1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] oom: fix tasklist_lock leak 2010-08-19 10:54 ` [PATCH 2/2] oom: fix tasklist_lock leak KOSAKI Motohiro @ 2010-08-19 16:05 ` Minchan Kim 2010-08-19 20:37 ` David Rientjes 2010-08-19 23:52 ` KAMEZAWA Hiroyuki 2 siblings, 0 replies; 9+ messages in thread From: Minchan Kim @ 2010-08-19 16:05 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, David Rientjes, Linus Torvalds, KAMEZAWA Hiroyuki On Thu, Aug 19, 2010 at 07:54:06PM +0900, KOSAKI Motohiro wrote: > commit 0aad4b3124 (oom: fold __out_of_memory into out_of_memory) > introduced tasklist_lock leak. Then it caused following obvious > danger warings and panic. > > ================================================ > [ BUG: lock held when returning to user space! ] > ------------------------------------------------ > rsyslogd/1422 is leaving the kernel with locks still held! > 1 lock held by rsyslogd/1422: > #0: (tasklist_lock){.+.+.+}, at: [<ffffffff810faf64>] out_of_memory+0x164/0x3f0 > BUG: scheduling while atomic: rsyslogd/1422/0x00000002 > INFO: lockdep is turned off. > > This patch fixes it. > > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> -- Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] oom: fix tasklist_lock leak 2010-08-19 10:54 ` [PATCH 2/2] oom: fix tasklist_lock leak KOSAKI Motohiro 2010-08-19 16:05 ` Minchan Kim @ 2010-08-19 20:37 ` David Rientjes 2010-08-19 23:52 ` KAMEZAWA Hiroyuki 2 siblings, 0 replies; 9+ messages in thread From: David Rientjes @ 2010-08-19 20:37 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, Linus Torvalds, KAMEZAWA Hiroyuki On Thu, 19 Aug 2010, KOSAKI Motohiro wrote: > commit 0aad4b3124 (oom: fold __out_of_memory into out_of_memory) > introduced tasklist_lock leak. Then it caused following obvious > danger warings and panic. > > ================================================ > [ BUG: lock held when returning to user space! ] > ------------------------------------------------ > rsyslogd/1422 is leaving the kernel with locks still held! > 1 lock held by rsyslogd/1422: > #0: (tasklist_lock){.+.+.+}, at: [<ffffffff810faf64>] out_of_memory+0x164/0x3f0 > BUG: scheduling while atomic: rsyslogd/1422/0x00000002 > INFO: lockdep is turned off. > > This patch fixes it. > > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: David Rientjes <rientjes@google.com> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] oom: fix tasklist_lock leak 2010-08-19 10:54 ` [PATCH 2/2] oom: fix tasklist_lock leak KOSAKI Motohiro 2010-08-19 16:05 ` Minchan Kim 2010-08-19 20:37 ` David Rientjes @ 2010-08-19 23:52 ` KAMEZAWA Hiroyuki 2 siblings, 0 replies; 9+ messages in thread From: KAMEZAWA Hiroyuki @ 2010-08-19 23:52 UTC (permalink / raw) To: KOSAKI Motohiro Cc: LKML, linux-mm, Andrew Morton, David Rientjes, Linus Torvalds On Thu, 19 Aug 2010 19:54:06 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote: > commit 0aad4b3124 (oom: fold __out_of_memory into out_of_memory) > introduced tasklist_lock leak. Then it caused following obvious > danger warings and panic. > > ================================================ > [ BUG: lock held when returning to user space! ] > ------------------------------------------------ > rsyslogd/1422 is leaving the kernel with locks still held! > 1 lock held by rsyslogd/1422: > #0: (tasklist_lock){.+.+.+}, at: [<ffffffff810faf64>] out_of_memory+0x164/0x3f0 > BUG: scheduling while atomic: rsyslogd/1422/0x00000002 > INFO: lockdep is turned off. > > This patch fixes it. > > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-08-19 23:57 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-08-19 10:52 [PATCH 0/2] oom: Fix two critical bug in 2.6.36-rc1 KOSAKI Motohiro 2010-08-19 10:53 ` [PATCH 1/2] oom: fix NULL pointer dereference KOSAKI Motohiro 2010-08-19 15:29 ` Minchan Kim 2010-08-19 20:35 ` David Rientjes 2010-08-19 23:50 ` KAMEZAWA Hiroyuki 2010-08-19 10:54 ` [PATCH 2/2] oom: fix tasklist_lock leak KOSAKI Motohiro 2010-08-19 16:05 ` Minchan Kim 2010-08-19 20:37 ` David Rientjes 2010-08-19 23:52 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox