Received: by 10.192.165.148 with SMTP id m20csp5063182imm; Tue, 24 Apr 2018 13:02:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+95Wqc07DBM3xsK8vCJ626DU4YQpSh5TbVH0TqTd2ocDe+dGOqTby3oA85F6hBALFTWSkO X-Received: by 2002:a17:902:24e:: with SMTP id 72-v6mr25641445plc.87.1524600173150; Tue, 24 Apr 2018 13:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524600173; cv=none; d=google.com; s=arc-20160816; b=FUV3dzQhiXQ0eVw9QlMf50yZzb5ZyYb7a3k7xVjiO83BU1HuXBrkbchxstHtqPS9tM N4LGc76mEKnOCUUbuIN1OMO559nuJY2ZC1T/Rft46nr1maKfKPiecfAQPM4jCKY7uru7 +X8K1TPlbsen20bj5/mUmmMUF/G/3M9EOpFtJuhnvf2gsuiSyFZd/Em3jWJrp71IsyfX UxI3sLeTVzgk4YEtMI+3t29DbpazdGebCeZeJhVUUF0kmT+C6shLt161l/unQMI1kWjk Moff5SuKAV9cKbb/L3cwaRv0kMnt3ZsUrTTYUxz7HMDflVqlBbL3MC6s3reVnT/CtfwM sj5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=45/eeK/2Hkuwi6jzlFsfzXDwY0Rgb2wy6iYACH9VFfs=; b=Lv90y+ZEXqrI7FgDLXuMOCNjjhnYBJ0/AB/Beo9oeoKNYwt4kJQzVzP0IeIl+ciq9j QvXhFIJ+IlkQlOj6L/WXutwzHDmgHS9NIgoqbs+6MFFN5K7SBozcaKErGku431PIIpNK 6L3AkztQRjbCujs8F7xlPExBlzBNVAUass4bWq5ZuoMVD8s49s7KpbjWKcenKt0LoEy7 KG8QD6NZtts0AOQIjdvTC/7Rrz910J7y9+DVHM7f+ZFJDXWiRMz77nsDP2Kc6ssE+YZK Z5PbLQP/RuvMiIrHplPAasGxWxszk/a7+uJjfkW9oIAW4a2yU/pbOOJNPDEiY9rDdA7l e6Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=k5deu0eW; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3-v6si13823459pll.126.2018.04.24.13.02.38; Tue, 24 Apr 2018 13:02:53 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=k5deu0eW; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751165AbeDXUBL (ORCPT + 99 others); Tue, 24 Apr 2018 16:01:11 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:41971 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962AbeDXUBG (ORCPT ); Tue, 24 Apr 2018 16:01:06 -0400 Received: by mail-pg0-f68.google.com with SMTP id m21so8632896pgv.8 for ; Tue, 24 Apr 2018 13:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=45/eeK/2Hkuwi6jzlFsfzXDwY0Rgb2wy6iYACH9VFfs=; b=k5deu0eW/x2hfxEcDvRguXzXRPGgpwX1kyRMbUsAmmuoVPVal7UFIQ66Z8f9LltRct qV8AO8cBATjUP7Qw8qoAcVtleWCLMRCjl5ddEr7rPu6pfMILRQUElpCrZm4Kx6ylJPX2 3JMy6hYs9Mccv1mn4JT8DTpoFgOwiJPW1IbagBqGXqBskrWHiCr59Lh7Cl5ljAZ86DK4 GNzEbwnAoq+z7kNHANsO2HpKlctqYLn/j0mjKHJEIBE49L2VCNFQzxEOBvjX24Qqt0qI /TA6yqUPFl9QR4I9zkqnx3sMZmYam6VHUR60KO6B5v3bAtD/riCFMRdGxEFKupUFmg0y AXxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=45/eeK/2Hkuwi6jzlFsfzXDwY0Rgb2wy6iYACH9VFfs=; b=W4g+4zeK13ZOtaPN3Dm7MF3jf7ygOuDuJoR85a+uZlt6m2AuLeLu/KxY/503zN7v1u NJyGmtQQn4rxgN2iflnC9w1L0j+5onxAZr4B6SZ92kWYtu4OSWXHo6Q22fqExRH1FJmk 6ku5wS4KJ4BIlwmw4gosFUX4+nXdn0iih4PW+3I+/ve8/CUmMphppH0IiZLs8HqtuA4H 3cQcgrKdDFbvNEKYfdWXKhkBu23i+JvbbKKtNRU7SDJwJw5kkUXZMDukM6Kx+l1eG/QM iUbGSYph7CLQFoU/uLcnqaYqb/5d4eMGEukkAhuKBUVRbHI8ooT6uCqS7H0sgO67IemG RdXg== X-Gm-Message-State: ALQs6tBsGMWtpjuJrmRPDamMv9VrD4LFBfWQL5oN4GOQtftNoq5nXHbF eWYek6zplqQN1OngG4uy8dy8sA== X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr26230278plh.206.1524600065763; Tue, 24 Apr 2018 13:01:05 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id t9sm31767719pgr.37.2018.04.24.13.01.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 13:01:04 -0700 (PDT) Date: Tue, 24 Apr 2018 13:01:03 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Michal Hocko , Andrew Morton cc: Tetsuo Handa , Andrea Arcangeli , guro@fb.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch v2] mm, oom: fix concurrent munlock and oom reaperunmap In-Reply-To: <20180424130432.GB17484@dhcp22.suse.cz> Message-ID: References: <20180419063556.GK17484@dhcp22.suse.cz> <20180420082349.GW17484@dhcp22.suse.cz> <20180420124044.GA17484@dhcp22.suse.cz> <201804221248.CHE35432.FtOMOLSHOFJFVQ@I-love.SAKURA.ne.jp> <20180424130432.GB17484@dhcp22.suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Apr 2018, Michal Hocko wrote: > Is there any reason why we cannot simply call __oom_reap_task_mm as we > have it now? mmap_sem for read shouldn't fail here because this is the > last reference of the mm and we are past the ksm and khugepaged > synchronizations. So unless my jed laged brain fools me the patch should > be as simple as the following (I haven't tested it at all). > I wanted to remove all per task checks because they are now irrelevant: this would be the first dependency that exit_mmap() has on any task_struct, which isn't intuitive -- we simply want to exit the mmap. There's no requirement that current owns the mm other than this. I wanted to avoid the implicit dependency on MMF_OOM_SKIP and make it explicit in the exit path to be matched with the oom reaper. I didn't want anything additional printed to the kernel log about oom reaping unless the oom_reaper actually needed to intervene, which is useful knowledge outside of basic exiting. My patch has passed intensive testing on both x86 and powerpc, so I'll ask that it's pushed for 4.17-rc3. Many thanks to Tetsuo for the suggestion on calling __oom_reap_task_mm() from exit_mmap().