From patchwork Mon Jun 27 12:15:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 9200459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B4E560757 for ; Mon, 27 Jun 2016 12:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F020528578 for ; Mon, 27 Jun 2016 12:15:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4E662857C; Mon, 27 Jun 2016 12:15:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 739AB28578 for ; Mon, 27 Jun 2016 12:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751831AbcF0MPe (ORCPT ); Mon, 27 Jun 2016 08:15:34 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35888 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbcF0MPc (ORCPT ); Mon, 27 Jun 2016 08:15:32 -0400 Received: by mail-wm0-f68.google.com with SMTP id c82so24029233wme.3; Mon, 27 Jun 2016 05:15:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4MEYVfTtxoTvxxW7OHyYejV4TTRX5lDZH7XeD2Ra+JU=; b=PbAK1L5bd03LnjPKFhG7YpubEZMRIPKupudZ8EYAqU1A383MW3OWSa1Z8BQS0e3biK /0cJVMBPA/hEUWrHY8/X/Sqtk3kSF6gMtGf7tgpHIkEW8bJkGShqQoGpe/VO5gXSNdi9 dKgGUA0Ty39Y3dQrN9udBaH5JZt/1Y34Kt5EcWJDslGpJz0iLdAgj/bbYaUl3XjTO8J5 Iq55vGHK8g0Vcwts7boWaByAiAlbV68NTJPWKtGgYNzCBO5USLjLs4wn74ktDQdcMpEK YvbOPj284HAL8yunJ4rYGx1uw3JBIb26QvaWipmLlp09M1hXMzA+Hmf+BBjWcxKUPpjN ITwQ== X-Gm-Message-State: ALyK8tImT0ZbL22M3NHgdzsCHA2QxN5ru42SSlow7WdCqII1jnumWKG1NRQCrWiKFZNxYg== X-Received: by 10.28.45.142 with SMTP id t136mr10105736wmt.40.1467029730526; Mon, 27 Jun 2016 05:15:30 -0700 (PDT) Received: from tiehlicka.suse.cz ([80.188.202.66]) by smtp.gmail.com with ESMTPSA id d192sm5100817wmd.14.2016.06.27.05.15.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 05:15:29 -0700 (PDT) From: Michal Hocko To: Andrew Morton Cc: David Rientjes , Miao Xie , "Rafael J. Wysocki" , , LKML , linux-pm@vger.kernel.org, Michal Hocko Subject: [PATCH 1/2] freezer, oom: check TIF_MEMDIE on the correct task Date: Mon, 27 Jun 2016 14:15:18 +0200 Message-Id: <1467029719-17602-2-git-send-email-mhocko@kernel.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1467029719-17602-1-git-send-email-mhocko@kernel.org> References: <1467029719-17602-1-git-send-email-mhocko@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michal Hocko freezing_slow_path is checking TIF_MEMDIE to skip OOM killed tasks. It is, however, checking the flag on the current task rather than the given one. This is really confusing because freezing() can be called also on !current tasks. It would end up working correctly for its main purpose because __refrigerator will be always called on the current task so the oom victim will never get frozen. But it could lead to surprising results when a task which is freezing a cgroup got oom killed because only part of the cgroup would get frozen. This is highly unlikely but worth fixing as the resulting code would be more clear anyway. Signed-off-by: Michal Hocko --- kernel/freezer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/freezer.c b/kernel/freezer.c index a8900a3bc27a..6f56a9e219fa 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -42,7 +42,7 @@ bool freezing_slow_path(struct task_struct *p) if (p->flags & (PF_NOFREEZE | PF_SUSPEND_TASK)) return false; - if (test_thread_flag(TIF_MEMDIE)) + if (test_tsk_thread_flag(p, TIF_MEMDIE)) return false; if (pm_nosig_freezing || cgroup_freezing(p))