Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp390324pxb; Wed, 24 Feb 2021 05:10:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwD56hHcAN3M0th6/K131BiEnzPloOoszCpEakMrfRjBK0bUWyp6Le7TypdwYnSq3PC4cgC X-Received: by 2002:a05:6402:1d9b:: with SMTP id dk27mr17902416edb.209.1614172202358; Wed, 24 Feb 2021 05:10:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614172202; cv=none; d=google.com; s=arc-20160816; b=f1nA5y1x0/Usr+K5Le07pfvFSNHIdPTT7BUlviKh2w9Hu+0nmZelFN6kKF2MMChwBN I5/yQ8ijgKKzPh47ZCO9z67jB7TmWjn7nzzlrAmQ7Q6ep9H8zFJeTX6rJmPmWW6RlJT4 IOcUItx+uAQCk9uGFtxjkA028GXgXGbDaZRaY25U6JHCx5/Pg+W7dR67oFK8c4+zo35H Tco5hrtmmlhRDvG1IENvKVK5uMe8bLUD+KLNQWJJDEqFr+2loED0Gj5NbLS4HAOPnpX8 IPSRKr99Yi+hyPOt+MDOyvmAx74M6Qubfx6sF727TLChlvLnaUDYgFh6dIOKqJ6tM1gM txVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FeA/2l27nVF/DGAxR2L37LYDHmL612+GcS6A2XoF94U=; b=FDYRRgWmQnLJTrolaSi4lIc3Qu1rTi8sf7Hw+j+Yg7PTFwe01nyX57zI+Kgtb2Iw+S X9HzBHSgvJDuaJKbyO8axWCUDIx28TO8fxLLxOPh5NmWn8UgfHK7i7hHdzhQqdmQNIbw nx+KvDv+PXcshp5b2BMZzlp2FUBCRs1/ovsKvkrhUNuNFIdD6ol/mtXtRPNwkAz5BWvh Yek/UW2DGVsIHmxehpp4Octu+0XchQOIpt7CZOk0kZox0bu3RINy53SDPNV5UFjuzA3Q uF9OHPHgM1iwW6Prta5Jv94b8U5UOrxKPFcnsQ7nkfkWvy7nNc7+M1F2qrnZvdIVhxOn fifA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=aaBZQMHz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si1410414ejg.569.2021.02.24.05.09.19; Wed, 24 Feb 2021 05:10:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=aaBZQMHz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234451AbhBXJPf (ORCPT + 99 others); Wed, 24 Feb 2021 04:15:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:46202 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234349AbhBXJPT (ORCPT ); Wed, 24 Feb 2021 04:15:19 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1614158072; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FeA/2l27nVF/DGAxR2L37LYDHmL612+GcS6A2XoF94U=; b=aaBZQMHz3G2QqX4ncvXcTnQO6jkI1yH4iqWbcFQWhBD7EViANhw9jiT2vp3seI1HsyFSHz ZGrnILaRTgItVS3oEERlci6psg1StBolgA/TJ9EfmWhvjHMFwKMRGLT9uASLTYL9THTzg8 2dQ0FGLeQuWebMaa7i6C5FzcFk63OKs= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D3323AE47; Wed, 24 Feb 2021 09:14:31 +0000 (UTC) Date: Wed, 24 Feb 2021 10:14:31 +0100 From: Michal Hocko To: Shakeel Butt Cc: David Rientjes , Johannes Weiner , Roman Gushchin , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memcg: enable memcg oom-kill for __GFP_NOFAIL Message-ID: References: <20210223204337.2785120-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210223204337.2785120-1-shakeelb@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 23-02-21 12:43:37, Shakeel Butt wrote: > In the era of async memcg oom-killer, the commit a0d8b00a3381 ("mm: > memcg: do not declare OOM from __GFP_NOFAIL allocations") added the code > to skip memcg oom-killer for __GFP_NOFAIL allocations. The reason was > that the __GFP_NOFAIL callers will not enter aync oom synchronization > path and will keep the task marked as in memcg oom. At that time the > tasks marked in memcg oom can bypass the memcg limits and the oom > synchronization would have happened later in the later userspace > triggered page fault. Thus letting the task marked as under memcg oom > bypass the memcg limit for arbitrary time. > > With the synchronous memcg oom-killer (commit 29ef680ae7c21 ("memcg, > oom: move out_of_memory back to the charge path")) and not letting the > task marked under memcg oom to bypass the memcg limits (commit > 1f14c1ac19aa4 ("mm: memcg: do not allow task about to OOM kill to bypass > the limit")), we can again allow __GFP_NOFAIL allocations to trigger > memcg oom-kill. This will make memcg oom behavior closer to page > allocator oom behavior. The patch is correct, I just do follow why 1f14c1ac19aa4 is really relevant here. There nomem label wouldn't make any difference for __GFP_NOFAIL requests. The code has has changed quite a lot since then. > Signed-off-by: Shakeel Butt This is a clear overlook when I moved the oom handling back to the charge path. Thanks for the fixup. Acked-by: Michal Hocko > --- > mm/memcontrol.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 2db2aeac8a9e..dcb5665aeb69 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -2797,9 +2797,6 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > if (gfp_mask & __GFP_RETRY_MAYFAIL) > goto nomem; > > - if (gfp_mask & __GFP_NOFAIL) > - goto force; > - > if (fatal_signal_pending(current)) > goto force; > > -- > 2.30.0.617.g56c4b15f3c-goog -- Michal Hocko SUSE Labs