All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Kyle Walker <kwalker@redhat.com>
Cc: akpm@linux-foundation.org, mhocko@suse.cz, rientjes@google.com,
	hannes@cmpxchg.org, vdavydov@parallels.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Stanislav Kozina <skozina@redhat.com>
Subject: Re: [PATCH] mm/oom_kill.c: don't kill TASK_UNINTERRUPTIBLE tasks
Date: Thu, 17 Sep 2015 21:22:04 +0200	[thread overview]
Message-ID: <20150917192204.GA2728@redhat.com> (raw)
In-Reply-To: <1442512783-14719-1-git-send-email-kwalker@redhat.com>

Add cc's.

On 09/17, Kyle Walker wrote:
>
> Currently, the oom killer will attempt to kill a process that is in
> TASK_UNINTERRUPTIBLE state. For tasks in this state for an exceptional
> period of time, such as processes writing to a frozen filesystem during
> a lengthy backup operation, this can result in a deadlock condition as
> related processes memory access will stall within the page fault
> handler.
>
> Within oom_unkillable_task(), check for processes in
> TASK_UNINTERRUPTIBLE (TASK_KILLABLE omitted). The oom killer will
> move on to another task.
>
> Signed-off-by: Kyle Walker <kwalker@redhat.com>
> ---
>  mm/oom_kill.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 1ecc0bc..66f03f8 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -131,6 +131,10 @@ static bool oom_unkillable_task(struct task_struct *p,
>  	if (memcg && !task_in_mem_cgroup(p, memcg))
>  		return true;
>
> +	/* Uninterruptible tasks should not be killed unless in TASK_WAKEKILL */
> +	if (p->state == TASK_UNINTERRUPTIBLE)
> +		return true;
> +

So we can skip a memory hog which, say, does mutex_lock(). And this can't
help if this task is multithreaded, unless all its sub-threads are in "D"
state too oom killer will pick another thread with the same ->mm. Plus
other problems.

But yes, such a deadlock is possible. I would really like to see the comments
from maintainers. In particular, I seem to recall that someone suggested to
try to kill another !TIF_MEMDIE process after timeout, perhaps this is what
we should actually do...

Oleg.

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Kyle Walker <kwalker@redhat.com>
Cc: akpm@linux-foundation.org, mhocko@suse.cz, rientjes@google.com,
	hannes@cmpxchg.org, vdavydov@parallels.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Stanislav Kozina <skozina@redhat.com>
Subject: Re: [PATCH] mm/oom_kill.c: don't kill TASK_UNINTERRUPTIBLE tasks
Date: Thu, 17 Sep 2015 21:22:04 +0200	[thread overview]
Message-ID: <20150917192204.GA2728@redhat.com> (raw)
In-Reply-To: <1442512783-14719-1-git-send-email-kwalker@redhat.com>

Add cc's.

On 09/17, Kyle Walker wrote:
>
> Currently, the oom killer will attempt to kill a process that is in
> TASK_UNINTERRUPTIBLE state. For tasks in this state for an exceptional
> period of time, such as processes writing to a frozen filesystem during
> a lengthy backup operation, this can result in a deadlock condition as
> related processes memory access will stall within the page fault
> handler.
>
> Within oom_unkillable_task(), check for processes in
> TASK_UNINTERRUPTIBLE (TASK_KILLABLE omitted). The oom killer will
> move on to another task.
>
> Signed-off-by: Kyle Walker <kwalker@redhat.com>
> ---
>  mm/oom_kill.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 1ecc0bc..66f03f8 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -131,6 +131,10 @@ static bool oom_unkillable_task(struct task_struct *p,
>  	if (memcg && !task_in_mem_cgroup(p, memcg))
>  		return true;
>
> +	/* Uninterruptible tasks should not be killed unless in TASK_WAKEKILL */
> +	if (p->state == TASK_UNINTERRUPTIBLE)
> +		return true;
> +

So we can skip a memory hog which, say, does mutex_lock(). And this can't
help if this task is multithreaded, unless all its sub-threads are in "D"
state too oom killer will pick another thread with the same ->mm. Plus
other problems.

But yes, such a deadlock is possible. I would really like to see the comments
from maintainers. In particular, I seem to recall that someone suggested to
try to kill another !TIF_MEMDIE process after timeout, perhaps this is what
we should actually do...

Oleg.


  reply	other threads:[~2015-09-17 19:25 UTC|newest]

Thread overview: 213+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 17:59 [PATCH] mm/oom_kill.c: don't kill TASK_UNINTERRUPTIBLE tasks Kyle Walker
2015-09-17 17:59 ` Kyle Walker
2015-09-17 19:22 ` Oleg Nesterov [this message]
2015-09-17 19:22   ` Oleg Nesterov
2015-09-18 15:41   ` Christoph Lameter
2015-09-18 15:41     ` Christoph Lameter
2015-09-18 16:24     ` Oleg Nesterov
2015-09-18 16:24       ` Oleg Nesterov
2015-09-18 16:39       ` Tetsuo Handa
2015-09-18 16:39         ` Tetsuo Handa
2015-09-18 16:54         ` Oleg Nesterov
2015-09-18 16:54           ` Oleg Nesterov
2015-09-18 17:00       ` Christoph Lameter
2015-09-18 17:00         ` Christoph Lameter
2015-09-18 19:07         ` Oleg Nesterov
2015-09-18 19:07           ` Oleg Nesterov
2015-09-18 19:19           ` Christoph Lameter
2015-09-18 19:19             ` Christoph Lameter
2015-09-18 21:28             ` Kyle Walker
2015-09-18 22:07               ` Christoph Lameter
2015-09-18 22:07                 ` Christoph Lameter
2015-09-19  8:32         ` Michal Hocko
2015-09-19  8:32           ` Michal Hocko
2015-09-19 14:33           ` Tetsuo Handa
2015-09-19 14:33             ` Tetsuo Handa
2015-09-19 15:51             ` Michal Hocko
2015-09-19 15:51               ` Michal Hocko
2015-09-21 23:33             ` David Rientjes
2015-09-21 23:33               ` David Rientjes
2015-09-22  5:33               ` Tetsuo Handa
2015-09-22  5:33                 ` Tetsuo Handa
2015-09-22 23:32                 ` David Rientjes
2015-09-22 23:32                   ` David Rientjes
2015-09-23 12:03                   ` Kyle Walker
2015-09-23 12:03                     ` Kyle Walker
2015-09-24 11:50                     ` Tetsuo Handa
2015-09-24 11:50                       ` Tetsuo Handa
2015-09-19 14:44           ` Oleg Nesterov
2015-09-19 14:44             ` Oleg Nesterov
2015-09-21 23:27         ` David Rientjes
2015-09-21 23:27           ` David Rientjes
2015-09-19  8:25     ` Michal Hocko
2015-09-19  8:25       ` Michal Hocko
2015-09-19  8:22 ` Michal Hocko
2015-09-19  8:22   ` Michal Hocko
2015-09-21 23:08   ` David Rientjes
2015-09-21 23:08     ` David Rientjes
2015-09-19 15:03 ` can't oom-kill zap the victim's memory? Oleg Nesterov
2015-09-19 15:03   ` Oleg Nesterov
2015-09-19 15:10   ` Oleg Nesterov
2015-09-19 15:10     ` Oleg Nesterov
2015-09-19 15:58   ` Michal Hocko
2015-09-19 15:58     ` Michal Hocko
2015-09-20 13:16     ` Oleg Nesterov
2015-09-20 13:16       ` Oleg Nesterov
2015-09-19 22:24   ` Linus Torvalds
2015-09-19 22:24     ` Linus Torvalds
2015-09-19 22:54     ` Raymond Jennings
2015-09-19 23:00     ` Raymond Jennings
2015-09-19 23:00       ` Raymond Jennings
2015-09-19 23:13       ` Linus Torvalds
2015-09-19 23:13         ` Linus Torvalds
2015-09-20  9:33     ` Michal Hocko
2015-09-20  9:33       ` Michal Hocko
2015-09-20 13:06       ` Oleg Nesterov
2015-09-20 13:06         ` Oleg Nesterov
2015-09-20 12:56     ` Oleg Nesterov
2015-09-20 12:56       ` Oleg Nesterov
2015-09-20 18:05       ` Linus Torvalds
2015-09-20 18:05         ` Linus Torvalds
2015-09-20 18:21         ` Raymond Jennings
2015-09-20 18:23         ` Raymond Jennings
2015-09-20 19:07         ` Raymond Jennings
2015-09-20 19:07           ` Raymond Jennings
2015-09-21 13:57           ` Oleg Nesterov
2015-09-21 13:57             ` Oleg Nesterov
2015-09-21 13:44         ` Oleg Nesterov
2015-09-21 13:44           ` Oleg Nesterov
2015-09-21 14:24           ` Michal Hocko
2015-09-21 14:24             ` Michal Hocko
2015-09-21 15:32             ` Oleg Nesterov
2015-09-21 15:32               ` Oleg Nesterov
2015-09-21 16:12               ` Michal Hocko
2015-09-21 16:12                 ` Michal Hocko
2015-09-22 16:06                 ` Oleg Nesterov
2015-09-22 16:06                   ` Oleg Nesterov
2015-09-22 23:04                   ` David Rientjes
2015-09-22 23:04                     ` David Rientjes
2015-09-23 20:59                   ` Michal Hocko
2015-09-23 20:59                     ` Michal Hocko
2015-09-24 21:15                     ` David Rientjes
2015-09-24 21:15                       ` David Rientjes
2015-09-25  9:35                       ` Michal Hocko
2015-09-25  9:35                         ` Michal Hocko
2015-09-25 16:14                         ` Tetsuo Handa
2015-09-25 16:14                           ` Tetsuo Handa
2015-09-28 16:18                           ` Tetsuo Handa
2015-09-28 16:18                             ` Tetsuo Handa
2015-09-28 22:28                             ` David Rientjes
2015-09-28 22:28                               ` David Rientjes
2015-10-02 12:36                             ` Michal Hocko
2015-10-02 12:36                               ` Michal Hocko
2015-10-02 19:01                               ` Linus Torvalds
2015-10-02 19:01                                 ` Linus Torvalds
2015-10-05 14:44                                 ` Michal Hocko
2015-10-05 14:44                                   ` Michal Hocko
2015-10-07  5:16                                   ` Vlastimil Babka
2015-10-07  5:16                                     ` Vlastimil Babka
2015-10-07 10:43                                     ` Tetsuo Handa
2015-10-07 10:43                                       ` Tetsuo Handa
2015-10-08  9:40                                       ` Vlastimil Babka
2015-10-08  9:40                                         ` Vlastimil Babka
2015-10-06  7:55                                 ` Eric W. Biederman
2015-10-06  7:55                                   ` Eric W. Biederman
2015-10-06  8:49                                   ` Linus Torvalds
2015-10-06  8:49                                     ` Linus Torvalds
2015-10-06  8:55                                     ` Linus Torvalds
2015-10-06  8:55                                       ` Linus Torvalds
2015-10-06 14:52                                       ` Eric W. Biederman
2015-10-06 14:52                                         ` Eric W. Biederman
2015-10-03  6:02                               ` Can't we use timeout based OOM warning/killing? Tetsuo Handa
2015-10-03  6:02                                 ` Tetsuo Handa
2015-10-06 14:51                                 ` Tetsuo Handa
2015-10-06 14:51                                   ` Tetsuo Handa
2015-10-12  6:43                                   ` Tetsuo Handa
2015-10-12  6:43                                     ` Tetsuo Handa
2015-10-12 15:25                                     ` Silent hang up caused by pages being not scanned? Tetsuo Handa
2015-10-12 15:25                                       ` Tetsuo Handa
2015-10-12 21:23                                       ` Linus Torvalds
2015-10-12 21:23                                         ` Linus Torvalds
2015-10-13 12:21                                         ` Tetsuo Handa
2015-10-13 12:21                                           ` Tetsuo Handa
2015-10-13 16:37                                           ` Linus Torvalds
2015-10-13 16:37                                             ` Linus Torvalds
2015-10-14 12:21                                             ` Tetsuo Handa
2015-10-14 12:21                                               ` Tetsuo Handa
2015-10-15 13:14                                             ` Michal Hocko
2015-10-15 13:14                                               ` Michal Hocko
2015-10-16 15:57                                               ` Michal Hocko
2015-10-16 15:57                                                 ` Michal Hocko
2015-10-16 18:34                                                 ` Linus Torvalds
2015-10-16 18:34                                                   ` Linus Torvalds
2015-10-16 18:49                                                   ` Tetsuo Handa
2015-10-16 18:49                                                     ` Tetsuo Handa
2015-10-19 12:57                                                     ` Michal Hocko
2015-10-19 12:57                                                       ` Michal Hocko
2015-10-19 12:53                                                   ` Michal Hocko
2015-10-19 12:53                                                     ` Michal Hocko
2015-10-13 13:32                                       ` Michal Hocko
2015-10-13 13:32                                         ` Michal Hocko
2015-10-13 16:19                                         ` Tetsuo Handa
2015-10-13 16:19                                           ` Tetsuo Handa
2015-10-14 13:22                                           ` Michal Hocko
2015-10-14 13:22                                             ` Michal Hocko
2015-10-14 14:38                                             ` Tetsuo Handa
2015-10-14 14:38                                               ` Tetsuo Handa
2015-10-14 14:59                                               ` Michal Hocko
2015-10-14 14:59                                                 ` Michal Hocko
2015-10-14 15:06                                                 ` Tetsuo Handa
2015-10-14 15:06                                                   ` Tetsuo Handa
2015-10-26 11:44                                     ` Newbie's question: memory allocation when reclaiming memory Tetsuo Handa
2015-10-26 11:44                                       ` Tetsuo Handa
2015-11-05  8:46                                       ` Vlastimil Babka
2015-11-05  8:46                                         ` Vlastimil Babka
2015-10-06 15:25                                 ` Can't we use timeout based OOM warning/killing? Linus Torvalds
2015-10-08 15:33                                   ` Tetsuo Handa
2015-10-08 15:33                                     ` Tetsuo Handa
2015-10-10 12:50                                 ` Tetsuo Handa
2015-10-10 12:50                                   ` Tetsuo Handa
2015-09-28 22:24                         ` can't oom-kill zap the victim's memory? David Rientjes
2015-09-28 22:24                           ` David Rientjes
2015-09-29  7:57                           ` Tetsuo Handa
2015-09-29  7:57                             ` Tetsuo Handa
2015-09-29 22:56                             ` David Rientjes
2015-09-29 22:56                               ` David Rientjes
2015-09-30  4:25                               ` Tetsuo Handa
2015-09-30  4:25                                 ` Tetsuo Handa
2015-09-30 10:21                                 ` Tetsuo Handa
2015-09-30 10:21                                   ` Tetsuo Handa
2015-09-30 21:11                                 ` David Rientjes
2015-09-30 21:11                                   ` David Rientjes
2015-10-01 12:13                                   ` Tetsuo Handa
2015-10-01 12:13                                     ` Tetsuo Handa
2015-10-01 14:48                           ` Michal Hocko
2015-10-01 14:48                             ` Michal Hocko
2015-10-02 13:06                             ` Tetsuo Handa
2015-10-02 13:06                               ` Tetsuo Handa
2015-10-06 18:45                     ` Oleg Nesterov
2015-10-06 18:45                       ` Oleg Nesterov
2015-10-07 11:03                       ` Tetsuo Handa
2015-10-07 11:03                         ` Tetsuo Handa
2015-10-07 12:00                         ` Oleg Nesterov
2015-10-07 12:00                           ` Oleg Nesterov
2015-10-08 14:04                           ` Michal Hocko
2015-10-08 14:04                             ` Michal Hocko
2015-10-08 14:01                       ` Michal Hocko
2015-10-08 14:01                         ` Michal Hocko
2015-09-21 16:51               ` Tetsuo Handa
2015-09-21 16:51                 ` Tetsuo Handa
2015-09-22 12:43                 ` Oleg Nesterov
2015-09-22 12:43                   ` Oleg Nesterov
2015-09-22 14:30                   ` Tetsuo Handa
2015-09-22 14:30                     ` Tetsuo Handa
2015-09-22 14:45                     ` Oleg Nesterov
2015-09-22 14:45                       ` Oleg Nesterov
2015-09-21 23:42               ` David Rientjes
2015-09-21 23:42                 ` David Rientjes
2015-09-21 16:55           ` Linus Torvalds
2015-09-21 16:55             ` Linus Torvalds
2015-09-20 14:50   ` Tetsuo Handa
2015-09-20 14:50     ` Tetsuo Handa
2015-09-20 14:55     ` Oleg Nesterov
2015-09-20 14:55       ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150917192204.GA2728@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kwalker@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rientjes@google.com \
    --cc=skozina@redhat.com \
    --cc=vdavydov@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.