From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752426AbbIQSAL (ORCPT ); Thu, 17 Sep 2015 14:00:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37992 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbbIQSAH (ORCPT ); Thu, 17 Sep 2015 14:00:07 -0400 From: Kyle Walker To: akpm@linux-foundation.org Cc: mhocko@suse.cz, rientjes@google.com, hannes@cmpxchg.org, vdavydov@parallels.com, oleg@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kyle Walker Subject: [PATCH] mm/oom_kill.c: don't kill TASK_UNINTERRUPTIBLE tasks Date: Thu, 17 Sep 2015 13:59:43 -0400 Message-Id: <1442512783-14719-1-git-send-email-kwalker@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; + /* p may not have freeable memory in nodemask */ if (!has_intersects_mems_allowed(p, nodemask)) return true; -- 2.4.3