All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm,oom_reaper: Remove pointless kthread_run() error check.
@ 2017-11-08 10:43 Tetsuo Handa
  2017-11-08 15:01 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2017-11-08 10:43 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, Tetsuo Handa

Since oom_init() is called before userspace processes start, memory
allocation failure for creating the OOM reaper kernel thread will let
the OOM killer call panic() rather than wake up the OOM reaper.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 mm/oom_kill.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 8dd0e08..85eced9 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -641,9 +641,6 @@ static int oom_reaper(void *unused)
 
 static void wake_oom_reaper(struct task_struct *tsk)
 {
-	if (!oom_reaper_th)
-		return;
-
 	/* tsk is already queued? */
 	if (tsk == oom_reaper_list || tsk->oom_reaper_list)
 		return;
@@ -661,11 +658,6 @@ static void wake_oom_reaper(struct task_struct *tsk)
 static int __init oom_init(void)
 {
 	oom_reaper_th = kthread_run(oom_reaper, NULL, "oom_reaper");
-	if (IS_ERR(oom_reaper_th)) {
-		pr_err("Unable to start OOM reaper %ld. Continuing regardless\n",
-				PTR_ERR(oom_reaper_th));
-		oom_reaper_th = NULL;
-	}
 	return 0;
 }
 subsys_initcall(oom_init)
-- 
1.8.3.1

--
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 related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm,oom_reaper: Remove pointless kthread_run() error check.
  2017-11-08 10:43 [PATCH] mm,oom_reaper: Remove pointless kthread_run() error check Tetsuo Handa
@ 2017-11-08 15:01 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2017-11-08 15:01 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: akpm, linux-mm

Thank you that you have CCed me (as an author of the code)

On Wed 08-11-17 19:43:20, Tetsuo Handa wrote:
> Since oom_init() is called before userspace processes start, memory
> allocation failure for creating the OOM reaper kernel thread will let
> the OOM killer call panic() rather than wake up the OOM reaper.

Which is what I've tried to actually point out back then IIRC but you
have insisted hard so I've added the change to make a forward progress
on the whole work. The check is not harmful because this is not a
fast path but as you say we are likely to panic anyway.

> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Acked-by: Michal Hocko <mhocko@suse.com>
> ---
>  mm/oom_kill.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 8dd0e08..85eced9 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -641,9 +641,6 @@ static int oom_reaper(void *unused)
>  
>  static void wake_oom_reaper(struct task_struct *tsk)
>  {
> -	if (!oom_reaper_th)
> -		return;
> -
>  	/* tsk is already queued? */
>  	if (tsk == oom_reaper_list || tsk->oom_reaper_list)
>  		return;
> @@ -661,11 +658,6 @@ static void wake_oom_reaper(struct task_struct *tsk)
>  static int __init oom_init(void)
>  {
>  	oom_reaper_th = kthread_run(oom_reaper, NULL, "oom_reaper");
> -	if (IS_ERR(oom_reaper_th)) {
> -		pr_err("Unable to start OOM reaper %ld. Continuing regardless\n",
> -				PTR_ERR(oom_reaper_th));
> -		oom_reaper_th = NULL;
> -	}
>  	return 0;
>  }
>  subsys_initcall(oom_init)
> -- 
> 1.8.3.1
> 
> --
> 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>

-- 
Michal Hocko
SUSE Labs

--
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] 2+ messages in thread

end of thread, other threads:[~2017-11-08 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 10:43 [PATCH] mm,oom_reaper: Remove pointless kthread_run() error check Tetsuo Handa
2017-11-08 15:01 ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.