Received: by 10.213.65.68 with SMTP id h4csp135462imn; Wed, 21 Mar 2018 14:23:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELvy6QDeWkDJWgWlV5qWwxRbt/PR044w2DrKUTFQjBm3Inv1YnrE4pgJbF0dZq9viqOrgmAg X-Received: by 2002:a17:902:82c2:: with SMTP id u2-v6mr21658096plz.401.1521667424141; Wed, 21 Mar 2018 14:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521667424; cv=none; d=google.com; s=arc-20160816; b=L9QfWbCuIhSd2vCwBdY50yNs0Wg218bjED1tKrRd/TkS6CUZdME7ud03daFPzHrm58 y+MK8hrJmVgMpiOfinM0sUSH0D8lan67jizGwoOc8RTCCSBYvG3pGw0qbf7cBWmnLl3t H7nPHHdROLI60tpNNEUK4WwLfaiSuVX1hW1OrAillOhpkY3aWZ4o+ws+ozlTIijgE+nq 6rZnlpBA6FyG19OrCLQ8tbUjyjOYjv6Nsf0P6kqPL1ixTzUppI+Btu+LVPzRgNTWStIn WTNnSMyEVoDS77jti0x84Mt5tKykpMebFg2kDwtbgUnB3hF2hywRRUfxVwkmnyxPqVBP CLKw== 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=dmi918U1A7sCY0bS8DnhPyoa6qLuzNQZlIMOqvFdpL8=; b=sEvoJ4NSjqs+clG1d5UzWv0ERVU5L/LwcgBOhv6BB2VA3ORbrWfLaWiVETnEaGSowa /cywvbidaw1sCiEGei28lT1wxfWGvcuScX3qxCWswNKYTe9PjzJYEmf43SF9vmzxsBr4 IVCHIIftlvhZkqJsVdshiDD7bhGcqureS3+xtUBriNt5CwHOR2rKxTCYltGxATmUeNMf m/XfROQHPSg7uvCvVmvdWhy+C+++oL8t4IzkSQ2Dzdkcq3TfTRSKMALth4L2xHr5Yg0Z INWfe5QblXJEK2PSSz5w+WnbiU5bzU9bCJKMmhp7GEDryoVIFXGX/S1466kTm75GamOy I3RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XSDMWPfo; 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 m3-v6si4799166pld.351.2018.03.21.14.23.29; Wed, 21 Mar 2018 14:23:44 -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=XSDMWPfo; 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 S1753671AbeCUVWU (ORCPT + 99 others); Wed, 21 Mar 2018 17:22:20 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:39464 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753495AbeCUVWP (ORCPT ); Wed, 21 Mar 2018 17:22:15 -0400 Received: by mail-pl0-f65.google.com with SMTP id k22-v6so3922964pls.6 for ; Wed, 21 Mar 2018 14:22:15 -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=dmi918U1A7sCY0bS8DnhPyoa6qLuzNQZlIMOqvFdpL8=; b=XSDMWPfoGXtyXPmSR5Pq5gH27XNG8F6Si4a3is53YU/s/wtyvUpdyRhPf3S1IZRRRq Ukdob2Iy3wqVwDJv3g5JkiZ6VJhGzVla4LXV+0iedCquCsf9VYbIan2m/U2vFuL9GDtv +pjQTqi5Eabmepw02tdQp7gKblVPaQ8nE9r/aUJlcrj7jvE5CoTNbf0C5MbO5j7tD7KJ hwyCy4zB2JyEIaNq3VuXEVo74X8qiXtgikQnhb8F1i0AMq92qA40yb7hfvCASLy8znN2 bR8ylyo2yh+i5QQ72/HaN54RzILtIBuoGySwyTlRCfWRrfBMxItcDZnZJfJs0pPb9U4D fPZQ== 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=dmi918U1A7sCY0bS8DnhPyoa6qLuzNQZlIMOqvFdpL8=; b=a1iMXbRggCHs0C9Dy5v/R3SaeCdqvnRRvCM6IQPgmUx5HXal1ag8eq/a2+autcmI46 UPOvdmGD0QoDKisUspwdl6XqOsNy5uUQ1LZRlYUlOLpqZSdvsfpphWzXPPwD8OoQRepz Q9hlg16lnOEAyQiAQB2BGehs5LEU8M4L+szv+x4Bt2hTPt5mzD2XPgBmMvP8d0BiueqS uFPX7Pbtd4jERPnuqCgWcjEqkcInI7AH2HW1jvgYgMb51KF17jTT7gkR3U5BylkHUkqj MoY6AGCIvic/HIcb/ddLbwVutbRv165ZOzxumOK4Fazhg7mpWJGz0gIFPXH3rtw4YXYJ datQ== X-Gm-Message-State: AElRT7GnoPoLCL+a76VHXPDYCmhQsdTayw+4m2tFyf0rCMAcFgHgH5Af 4iz/QkE+ivOEtO6hCwg739+2Dg== X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr15304130plp.142.1521667335094; Wed, 21 Mar 2018 14:22:15 -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 a7sm3992817pgq.74.2018.03.21.14.22.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 14:22:14 -0700 (PDT) Date: Wed, 21 Mar 2018 14:22:13 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Michal Hocko cc: Andrew Morton , Johannes Weiner , "Kirill A. Shutemov" , Vlastimil Babka , linux-mm@kvack.org, LKML , Michal Hocko Subject: Re: [PATCH] memcg, thp: do not invoke oom killer on thp charges In-Reply-To: <20180321205928.22240-1-mhocko@kernel.org> Message-ID: References: <20180321205928.22240-1-mhocko@kernel.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) 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 Wed, 21 Mar 2018, Michal Hocko wrote: > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index d1a917b5b7b7..08accbcd1a18 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1493,7 +1493,7 @@ static void memcg_oom_recover(struct mem_cgroup *memcg) > > static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order) > { > - if (!current->memcg_may_oom) > + if (!current->memcg_may_oom || order > PAGE_ALLOC_COSTLY_ORDER) > return; > /* > * We are in the middle of the charge context here, so we What bug reports have you received about order-4 and higher order non thp charges that this fixes? The patch title and the changelog specifically single out thp, which I've fixed, since it has sane fallback behavior and everything else uses __GFP_NORETRY. I think this is misusing a page allocator heuristic that hasn't been applied to the memcg charge path before to address a thp regression but generalizing it for all charges. PAGE_ALLOC_COSTLY_ORDER is a heuristic used by the page allocator because it cannot free high-order contiguous memory. Memcg just needs to reclaim a number of pages. Two order-3 charges can cause a memcg oom kill but now an order-4 charge cannot. It's an unfair bias against high-order charges that are not explicitly using __GFP_NORETRY.