Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1303685

Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates.

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates.
Date 2016-01-07 16:50 +0100
Message-ID <qOkZ4-1DY-39@gated-at.bofh.it> (permalink)
References <qL2YH-1hA-9@gated-at.bofh.it> <qOeTE-65o-23@gated-at.bofh.it> <qOiXf-hG-5@gated-at.bofh.it> <qOkcH-137-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu 07-01-16 15:58:41, Michal Hocko wrote:
> On Thu 07-01-16 22:31:32, Tetsuo Handa wrote:
> [...]
> > I think we need to filter at select_bad_process() and oom_kill_process().
> > 
> > When P has no children, P is chosen and TIF_MEMDIE is set on P. But P can
> > be chosen forever due to P->signal->oom_score_adj == OOM_SCORE_ADJ_MAX
> > even if the OOM reaper reclaimed P's mm. We need to ensure that
> > oom_kill_process() is not called with P if P already has TIF_MEMDIE.
> 
> Hmm. Any task is allowed to set its oom_score_adj that way and I
> guess we should really make sure that at least sysrq+f will make some
> progress. This is what I would do. Again I think this is worth a
> separate patch. Unless there are any objections I will roll out what I
> have and post 3 separate patches.
> ---
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 45e51ad2f7cf..ee34a51bd65a 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -333,6 +333,14 @@ static struct task_struct *select_bad_process(struct oom_control *oc,
>  		if (points == chosen_points && thread_group_leader(chosen))
>  			continue;
>  
> +		/*
> +		 * If the current major task is already ooom killed and this
> +		 * is sysrq+f request then we rather choose somebody else
> +		 * because the current oom victim might be stuck.
> +		 */
> +		if (is_sysrq_oom(sc) && test_tsk_thread_flag(p, TIF_MEMDIE))
> +			continue;
> +
>  		chosen = p;
>  		chosen_points = points;
>  	}

I guess we can move this up to oom_scan_process_thread already. It would
be simpler and I it should be also more appropriate because we already
do sysrq specific handling there:
---
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 45e51ad2f7cf..a27a43212075 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -277,10 +277,16 @@ enum oom_scan_t oom_scan_process_thread(struct oom_control *oc,
 	/*
 	 * This task already has access to memory reserves and is being killed.
 	 * Don't allow any other task to have access to the reserves.
+	 * If we are doing sysrq+f then it doesn't make any sense to check such
+	 * a task because it might be stuck and unable to terminate while the
+	 * forced OOM might be the only option left to get the system back to
+	 * work.
 	 */
 	if (test_tsk_thread_flag(task, TIF_MEMDIE)) {
 		if (!is_sysrq_oom(oc))
 			return OOM_SCAN_ABORT;
+		else
+			return OOM_SCAN_CONTINUE;
 	}
 	if (!task->mm)
 		return OOM_SCAN_CONTINUE;

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Michal Hocko <mhocko@kernel.org> - 2016-01-07 10:20 +0100
  Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-07 14:40 +0100
    Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Michal Hocko <mhocko@kernel.org> - 2016-01-07 16:00 +0100
      Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-07 16:40 +0100
        Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Michal Hocko <mhocko@kernel.org> - 2016-01-11 16:20 +0100
          Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-12 12:40 +0100
            Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Michal Hocko <mhocko@kernel.org> - 2016-01-12 21:00 +0100
              Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-13 11:20 +0100
                Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Michal Hocko <mhocko@kernel.org> - 2016-01-13 16:30 +0100
      Re: [PATCH] mm,oom: Exclude TIF_MEMDIE processes from candidates. Michal Hocko <mhocko@kernel.org> - 2016-01-07 16:50 +0100
        Re: [PATCH v2] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-08 11:20 +0100
          Re: [PATCH v2] mm,oom: Exclude TIF_MEMDIE processes from  candidates. David Rientjes <rientjes@google.com> - 2016-01-13 01:40 +0100
            Re: [PATCH v2] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-13 12:00 +0100
              Re: [PATCH v2] mm,oom: Exclude TIF_MEMDIE processes from  candidates. David Rientjes <rientjes@google.com> - 2016-01-14 02:00 +0100
                Re: [PATCH v2] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-14 11:30 +0100
                Re: [PATCH v2] mm,oom: Exclude TIF_MEMDIE processes from  candidates. David Rientjes <rientjes@google.com> - 2016-01-14 23:00 +0100
                Re: [PATCH v2] mm,oom: Exclude TIF_MEMDIE processes from candidates. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-14 23:30 +0100

csiph-web