From patchwork Mon Jun 27 12:15:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 9200457 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 131F260757 for ; Mon, 27 Jun 2016 12:15:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03C9028578 for ; Mon, 27 Jun 2016 12:15:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECB712857C; Mon, 27 Jun 2016 12:15:54 +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 963E228578 for ; Mon, 27 Jun 2016 12:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830AbcF0MPg (ORCPT ); Mon, 27 Jun 2016 08:15:36 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35195 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832AbcF0MPf (ORCPT ); Mon, 27 Jun 2016 08:15:35 -0400 Received: by mail-wm0-f68.google.com with SMTP id a66so24013189wme.2; Mon, 27 Jun 2016 05:15:34 -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=mzhEs6hv+Epv0NA5kqhVsGx3gmRpniit1SV/+ZjxZS8=; b=hkVRHGzD3BY9sQ9EMTcFMILNR9qDCpMcMtZinNcbSk0xGaxuMaV7oG4JRpLtNKCneI 1HlZlqMxnBjlzxf5OIf/y4A0oTgjvbGB+rDl5RM/V5uZ8/2UOntWFzw5nJ1z5b8UsY84 ggc8Y9d7TsmnLnt8OfdPFLoQLIizmweK7nqo9V4mIZaAZ5x4W//SKH4Z4ilgic1dwn5q g/OntbKE5UykH6DvR5ywxvUd5HwsA0cjZ351JmIXNhD4I5NDqF2im9TpX4rUMWeBgr/r 3QahRF4LBZstf/K6NvoBHH5e9+J5RxuwuBnnwYlwRIt9oi0XMf7d9PtsV1y8pDL02IP+ WoCA== X-Gm-Message-State: ALyK8tJVu7PS9o4WA/kDLwGHkspDN4zyakS+YVUuVJoIP8PivmVj95qL4c18CxU562sqjA== X-Received: by 10.194.239.163 with SMTP id vt3mr557657wjc.78.1467029733442; Mon, 27 Jun 2016 05:15:33 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 05:15:33 -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 2/2] cpuset, mm: fix TIF_MEMDIE check in cpuset_change_task_nodemask Date: Mon, 27 Jun 2016 14:15:19 +0200 Message-Id: <1467029719-17602-3-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 c0ff7453bb5c ("cpuset,mm: fix no node to alloc memory when changing cpuset's mems") has added TIF_MEMDIE and PF_EXITING check but it is checking the flag on the current task rather than the given one. This doesn't make much sense and it is actually wrong. If the current task which updates the nodemask of a cpuset got killed by the OOM killer then a part of the cpuset cgroup processes would have incompatible nodemask which is surprising to say the least. The comment suggests the intention was to skip oom victim or an exiting task so we should be checking the given task. But even then it would be layering violation becuase it is the memory allocator to interpret the TIF_MEMDIE meaning. Simply drop both checks. All tasks in the cpuset should simply follow the same mask. Cc: Miao Xie Signed-off-by: Michal Hocko --- kernel/cpuset.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 73e93e53884d..c7fd2778ed50 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -1034,15 +1034,6 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, { bool need_loop; - /* - * Allow tasks that have access to memory reserves because they have - * been OOM killed to get memory anywhere. - */ - if (unlikely(test_thread_flag(TIF_MEMDIE))) - return; - if (current->flags & PF_EXITING) /* Let dying task have memory */ - return; - task_lock(tsk); /* * Determine if a loop is necessary if another thread is doing