Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2143666imm; Thu, 7 Jun 2018 06:12:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKsw+eHR6ehAKCt+fPTV8YezsJEmItbjYI0DzeykN8jZJQRaW0C3wSk6cvOxRZVp5EPiqOq X-Received: by 2002:a17:902:9a06:: with SMTP id v6-v6mr1995974plp.21.1528377127504; Thu, 07 Jun 2018 06:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528377127; cv=none; d=google.com; s=arc-20160816; b=Vs+r6wQSGLAEwrgBU/s2ZMWENvEJHZi7PdQLEVDUB1TSkLhiQxM/tghLH38ejYXfgq f7dqINaDv21LBlzYusxO5lEs5tk/6ECD7VraIILMlbj8IvpZwGmZAB9RK7IMYZBe2NJY M3w9aomzKSEKn2TkqRAs3cxCKMNaGG/X0r0LzL3TZu1N+aJ0iPXOMk7XaniNJXHJkZC4 KXJYZH69o/UkiJpmMvnLO95qPcEUJ6qOyuRYaHvmPp6L127wB3w85h8UtdBX7ndRlb45 4ddg7LlEpxEjfsCdmlkI9LvHcKwNsBEW1N6Sa8gzMeg/bv0xZbrGMwSY7OeC00LMnHve NTvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=RoXgeLlO4c0O/SLWz1SjMq9+JtmqnsYW+sE04o+7K6Q=; b=MzuO5vtYT8ih5hPqKmbe3xt3rLFgseiSdwhtyW0Y7SmOf6bK9TRH0tC2SClGuilTrp zWgPV8jrIFdtRT1XMuB+W8j1v+85xg74aJtjPpetqYPhADin48S6NNMn3JWG2KHsY8q+ fFWP2vLgLAik0BdVxEG+nUj+j+P7TXthM8zeYa3d49Y/cN1em7BpCdFBtFn9LUTvV7Js 1N9Erd70E0WsKbL2Ky7oN2On11lRWsO1zdDIQrobvIPgi9olRMw9eNfrZN4QHLTF4euR OkcYkKXWBwIHhAhz+HdloLL8yFy7N1JRtdJizCBs0/cwO5W4DDtWUUfpqYjuDof0qV2h bXPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6-v6si3342559pfh.137.2018.06.07.06.11.34; Thu, 07 Jun 2018 06:12:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490AbeFGMTR (ORCPT + 99 others); Thu, 7 Jun 2018 08:19:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:42682 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753037AbeFGMTQ (ORCPT ); Thu, 7 Jun 2018 08:19:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BEB05ABF9; Thu, 7 Jun 2018 12:19:14 +0000 (UTC) Date: Thu, 7 Jun 2018 14:19:13 +0200 From: Michal Hocko To: "Eric W. Biederman" Cc: Andrew Morton , Johannes Weiner , Kirill Tkhai , peterz@infradead.org, viro@zeniv.linux.org.uk, mingo@kernel.org, paulmck@linux.vnet.ibm.com, keescook@chromium.org, riel@redhat.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, marcos.souza.org@gmail.com, hoeun.ryu@gmail.com, pasha.tatashin@oracle.com, gs051095@gmail.com, dhowells@redhat.com, rppt@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, Balbir Singh , Tejun Heo , Oleg Nesterov Subject: Re: [RFC][PATCH 1/2] memcg: Ensure every task that uses an mm is in the same memory cgroup Message-ID: <20180607121913.GO32433@dhcp22.suse.cz> References: <87wovu889o.fsf@xmission.com> <20180524111002.GB20441@dhcp22.suse.cz> <20180524141635.c99b7025a73a709e179f92a2@linux-foundation.org> <20180530121721.GD27180@dhcp22.suse.cz> <87wovjacrh.fsf@xmission.com> <87wovj8e1d.fsf_-_@xmission.com> <87y3fywodn.fsf_-_@xmission.com> <87sh66wobu.fsf_-_@xmission.com> <20180606111333.GF32433@dhcp22.suse.cz> <87wova6cw6.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wova6cw6.fsf@xmission.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 07-06-18 06:42:49, Eric W. Biederman wrote: > Michal Hocko writes: [...] > > Btw. MMF_ALIEN_MM could be used in the OOM proper as well. > > There are two big issues I see with your suggested alternative. > 1) cgroupv1 the task interface. We still need to deny migrating > part of a thread group. Hmm. Can we simply check the migrating tsk to be the thread group leader in can_attach and keep the silent migration skip? > 2) vfork. That uses CLONE_MM and it gets used. Right. MMF_ALIEN_MM would need a better check. I've forgot about this case. + if (unlikely(!(clone_flags & (CLONE_THREAD|CLONE_VFORK))) + set_bit(MMF_ALIEN_MM, &mm->flags); this would still allow to migrate mm via vforked task which is wrong so can_attach would have to special case vforked task as well. Which is, ehm, fuggly but that is something we have to handle regardless of MMF_ALIEN_MM... I will have to check your other patch but I suspect you haven't done that. Btw. neither did I when trying to work on this previously. > At a quick look > I am seeing gcc, g++, cpp, emacs24, strace, calendar, nm, telnet, gdb, > and several other programs I don't recognize. > > I believe your proposal will prevent onlining the memcgroup if there did you mean s@onlining@offlining@ ? > is a compile running, because of failure to support vfork. > > Further I expect we would need a count rather than a bit that gets set > and never gets cleared. Or else even when the mm is no longer shared by > vfork we will still think it is. Yes, but does that actually matter all that much to warrant an additional complexity? If somebody uses the funny threading model and want to migrate then the failure will likely get noticed regardless whether there is one or more processes sharing the mm. One failing while other succeeding sounds confusing. > Michal do you have an opinion on my previous patch? I guess you mean http://lkml.kernel.org/r/87wovj8e1d.fsf_-_@xmission.com Yes, I definitely plan to review this. I just need to find some time to focus on this without being interrupted by many other small things. > I just want to make certain that this fun work does not get all of the > attention, and the bug fix actually gets reviewed. Sure thing! -- Michal Hocko SUSE Labs