Received: by 10.213.65.68 with SMTP id h4csp145231imn; Wed, 21 Mar 2018 14:42:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELuRFhBRXsOtC80g3RyArq0GdxcSxkrI4l3OcfKCHVFbQqKNovp5nV284HMDPZvb8LE16N4s X-Received: by 10.101.74.136 with SMTP id b8mr2689062pgu.260.1521668535540; Wed, 21 Mar 2018 14:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521668535; cv=none; d=google.com; s=arc-20160816; b=r1ftL3Cm6uEjDn34xH6SaKj2EHIzhwgZtya1oB2ttk/eut8QvDlSzlOyiB17suZShV ZZVrWdj/tlDvbRdF0IUpuScKnFLmhTBoYRL4h+SaQ0bnJZJl5YEmDmeIvHm+c0fVXRky AIFGpk9HW0jAsuHa7zzmmYMR2lxf3demmdze9x3RCJq2cKVTYtCD/5I1nBNmWAyZTr2C ZzXuVv/Xfs32VnMmemy1XPtFGalzTiQ3sg3DIXGWwPDHKqnJA8fta+Mq1qEunXI+L7yh fntIqvB87/P96YdTSr0aSD0CMJmY97A8ts63a7eVecWUp9xaKU0E29OXRoZhi+lhQvSD /ssA== 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=m8KO4Z3bYwJH/PxZ9yKmbUbaCX6julg8RYarM7FlLwY=; b=evg9rsVWe/EQETQ/xhrxHkUzf0fO0roOurJHXuY/7AnOiCueTDcHnEplocxnj2fs4p gUT4TxGSrX0cJQuB6kSjD9UYaN2NO1PI2jLH/mKn4LH22r8ES90O+8Aii/MeKeBY1fx4 M34xPsdAYHRGoSqjIui5dleJaUBNiD1iXZ5s5hh7SHtCpkmdKgvS7K9GwcuS6IYyCIIq 0X+Fgee7DqmiM4hGHkSY0z6t2uqo9U43tG9kWs3xi6kXNQ7dbc2Z0Vkf+olnXq1Lv1Up p9EoGAcs1lD9SISLxpqsseoPV67ALz7BvpWbDe7/zINiv6Is9m5J6t9yAsTYPUQ/ig6J BN+w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12-v6si4838931plk.615.2018.03.21.14.42.01; Wed, 21 Mar 2018 14:42:15 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753749AbeCUVlI (ORCPT + 99 others); Wed, 21 Mar 2018 17:41:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:59341 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753574AbeCUVlH (ORCPT ); Wed, 21 Mar 2018 17:41:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 067A3AEB0; Wed, 21 Mar 2018 21:41:05 +0000 (UTC) Date: Wed, 21 Mar 2018 22:41:04 +0100 From: Michal Hocko To: David Rientjes Cc: Andrew Morton , Johannes Weiner , "Kirill A. Shutemov" , Vlastimil Babka , linux-mm@kvack.org, LKML Subject: Re: [PATCH] memcg, thp: do not invoke oom killer on thp charges Message-ID: <20180321214104.GT23100@dhcp22.suse.cz> References: <20180321205928.22240-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 21-03-18 14:22:13, David Rientjes wrote: > 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? We do not have any costly _OOM killable_ allocations but THP AFAIR. Or am I missing any? > 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. Yes, which is the whole point! We do not want a THP specific workaround. Just look at the bug your original patch was fixing. The regression was caused by a change which generalizes gfp masks for THP because different policies imply a different effort. As a side effect THP charges got OOM killable. I would call it quite non intuitive and error prone. > 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. PAGE_ALLOC_COSTLY_ORDER is documented and people know what to expect from such a request. Diverging from that behavior just comes as a surprise. There is no reason for that and as the above outlines it is error prone. -- Michal Hocko SUSE Labs