From patchwork Fri Dec 5 16:41:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 5444581 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4980CBEEA8 for ; Fri, 5 Dec 2014 16:42:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4C662010F for ; Fri, 5 Dec 2014 16:42:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 138922017A for ; Fri, 5 Dec 2014 16:42:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751597AbaLEQl5 (ORCPT ); Fri, 5 Dec 2014 11:41:57 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48649 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbaLEQlz (ORCPT ); Fri, 5 Dec 2014 11:41:55 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0D366AC18; Fri, 5 Dec 2014 16:41:54 +0000 (UTC) From: Michal Hocko To: Cc: Andrew Morton , Tejun Heo , "\\\"Rafael J. Wysocki\\\"" , David Rientjes , Johannes Weiner , Oleg Nesterov , Cong Wang , LKML , linux-pm@vger.kernel.org Subject: [PATCH -v2 2/5] OOM: thaw the OOM victim if it is frozen Date: Fri, 5 Dec 2014 17:41:44 +0100 Message-Id: <1417797707-31699-3-git-send-email-mhocko@suse.cz> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1417797707-31699-1-git-send-email-mhocko@suse.cz> References: <20141110163055.GC18373@dhcp22.suse.cz> <1417797707-31699-1-git-send-email-mhocko@suse.cz> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP oom_kill_process only sets TIF_MEMDIE flag and sends a signal to the victim. This is basically noop when the task is frozen though because the task sleeps in uninterruptible sleep. The victim is eventually thawed later when oom_scan_process_thread meets the task again in a later OOM invocation so the OOM killer doesn't live lock. But this is less than optimal. Let's add the frozen check and thaw the task right before we send SIGKILL to the victim. The check and thawing in oom_scan_process_thread has to stay because the task might got access to memory reserves even without an explicit SIGKILL from oom_kill_process (e.g. it already has fatal signal pending or it is exiting already). Signed-off-by: Michal Hocko --- mm/oom_kill.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index c75b37d59a32..8874058d62db 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -545,6 +545,8 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, rcu_read_unlock(); mark_tsk_oom_victim(victim); + if (frozen(victim)) + __thaw_task(victim); do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true); put_task_struct(victim); }