From patchwork Tue Feb 23 20:43:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12100891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39C21C433DB for ; Tue, 23 Feb 2021 20:43:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D9A4464DF5 for ; Tue, 23 Feb 2021 20:43:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9A4464DF5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4E5416B0005; Tue, 23 Feb 2021 15:43:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 46E916B0006; Tue, 23 Feb 2021 15:43:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3372A6B006E; Tue, 23 Feb 2021 15:43:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id 1918B6B0005 for ; Tue, 23 Feb 2021 15:43:54 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D5215824805A for ; Tue, 23 Feb 2021 20:43:53 +0000 (UTC) X-FDA: 77850709146.05.EB16ED1 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf01.hostedemail.com (Postfix) with ESMTP id AE48D2000385 for ; Tue, 23 Feb 2021 20:43:52 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id p15so10772430plq.8 for ; Tue, 23 Feb 2021 12:43:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=tAEo4In/0gx3aeLrRSAmN7UQ8VKqv74lEJhxcNM3pDE=; b=pNq6leRfIEyTpbzdvnSYqIa5/6uoeglwemLjqUX0IiWI8TeuF2G5lJMdEEeNcMegkl O8gXSmRbFBDs2+LfUtiO8uqvdm+8+6zCwGPlI1kuN6m/K6h4DYXcZQtK5IOqx9zVk4+n TUHEIgVRaat0jXeawkQ6LznVLYTsonjsmiFtth44j9oUWYUJyNwp9iM0lUduBUWN4odo YvTirH9MQ2knks30Akq6f3ezOTsPcfx/lQ2Z7GKBNvRzoihVWJrOFBn87IWdovViuj4s AYm2f0MuddRZ6VYqA/eHzlzS2FhYT/6lCwleqtKPCJpCUgCCiOF2r2v9A7ijcwQ0mMaw m46g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=tAEo4In/0gx3aeLrRSAmN7UQ8VKqv74lEJhxcNM3pDE=; b=qnDzfRZX96u6SwSOJRv5ZdnqI8Mdiz4kF2Ykiw8QQ5vL8gx0u2EE5qLJhRpH7B5jTL paSfL+aI8nU099w0gG/Qr/62m3yUCnPYqgFFE2DfIldsVkeuOr7U4LUXccrB3B2BrX8p SVQvua4jJQZ9w55m1KKRuQS+Nzk9SkUZ8tyGzPdb8ZOyVZotI8+Rd9PoAybV7FIo2EHa kB9+nX7LYKq4JCfD2LUoBcTl9nVIBe/i+kHsYXAWqWHYksaId5tHafrN4n2xBk3eHYZo ySM7/eVLkVnXZlrzv2WDcKZUoVbvU6z6oMXgiBRwWLJizzPK5p16PooiydxkqKICO0iz DClQ== X-Gm-Message-State: AOAM530s7MsOwEo7jK+kyAEWvSxfbYcKeknhe13BIw3YFyj+00llPYEU 2YbHbBEL2cPbVOSoO0L7OOKLUBazWzfr+Q== X-Google-Smtp-Source: ABdhPJwwwVjOjQAH3kCFA1d6qpxNRK4AjF2+AXyqpkEicA4UtizFeD7GiN7a8129xZsdezQY7SVuuyIiRTrgOw== X-Received: from shakeelb.svl.corp.google.com ([2620:15c:2cd:202:8ccd:3283:c85b:61eb]) (user=shakeelb job=sendgmr) by 2002:a17:90a:404c:: with SMTP id k12mr659123pjg.4.1614113032046; Tue, 23 Feb 2021 12:43:52 -0800 (PST) Date: Tue, 23 Feb 2021 12:43:37 -0800 Message-Id: <20210223204337.2785120-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.617.g56c4b15f3c-goog Subject: [PATCH] memcg: enable memcg oom-kill for __GFP_NOFAIL From: Shakeel Butt To: David Rientjes , Johannes Weiner Cc: Roman Gushchin , Michal Hocko , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt X-Stat-Signature: teiaxmztyyhb11d35tj48zdpy9pioyyt X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: AE48D2000385 Received-SPF: none (flex--shakeelb.bounces.google.com>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from="<3CGk1YAgKCLcpeXhbbiYdlldib.Zljifkru-jjhsXZh.lod@flex--shakeelb.bounces.google.com>"; helo=mail-pl1-f201.google.com; client-ip=209.85.214.201 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614113032-71379 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Signed-off-by: Shakeel Butt Acked-by: Michal Hocko Acked-by: Johannes Weiner Acked-by: David Rientjes --- 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;