Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6423880rwl; Mon, 9 Jan 2023 08:10:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXvluDAm9TUf4PF6IHZG5uriTN1LfkVU+MS4zRYYrz73nNgCHw7kvlSM3o2QTnUOsJfe8Z8n X-Received: by 2002:aa7:c907:0:b0:499:b672:ee3a with SMTP id b7-20020aa7c907000000b00499b672ee3amr2571917edt.12.1673280615199; Mon, 09 Jan 2023 08:10:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673280615; cv=none; d=google.com; s=arc-20160816; b=bfklIe7aNRf99PjSYSDOX7Bpy9rBo/d3oGfqL4ZB92IT2xCEsKMCTrZ7/b0zrNXwkf jGgrnWCduZgY7+D9VbW+Y0Ta9dL2aKWt+Tu68BqovvlVzgqTNeRN5ZMbNjUYxw+7Z23h 8X5dWd8zmYuUSNIxGL5qnZiD9JzSQF6G1Z47j6os5e57LjLAzM8UZlrM0hZOkSyEJVPZ FI7Otgm4Q7AxR9uJv2lARVIKz6KJ45iIHqDo49YY4BBx2QRsx/m5MLoahM8UNr92m9o6 nIB2c3iHrcMCBqRhTNSyiUJp2KIHXPLLT2Gs4zI5PZRYPfFId53n2wvAuJwV6d6WrTyP B6/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=0AmY71UyNWLVxnWmBBitB7lJMcyRbrVL3L3ELFNbV/c=; b=oa4Q2UPcdyKI0L6VLvfWPjzHTAumn+7zKCMihYuicREET0MLUUoL1lbi4ZTwznce6c npz+E13l7vPybC9ipaS9mhPX27d3HUnpmcQmpEb22lyIkFgvOAcLYcMTaeKpO70UlSLW dBrs0a1wAS6YGDZm7ksTPW2qwhnh+sMjyTz8nBEC/5+rL8iDc2tB1mmc3rlso2RsXOfL OJgGDVJsJTWV5nzqknEPSG8yYKi3RqoTtMiIp3TyEPGTXeaw1eDbW3fY5cDDi4SJ39Be DlKl6EitjI0+NXTPNs92V+ozHLA+oStamdW3J6+U5ur5e2Zne1Yyn2BTdJQqI5PKLeVu 688Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k26-20020aa7d8da000000b0048bed17d7d9si8667258eds.8.2023.01.09.08.10.02; Mon, 09 Jan 2023 08:10:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237192AbjAIPSc (ORCPT + 53 others); Mon, 9 Jan 2023 10:18:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237373AbjAIPRj (ORCPT ); Mon, 9 Jan 2023 10:17:39 -0500 Received: from outbound-smtp03.blacknight.com (outbound-smtp03.blacknight.com [81.17.249.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8269E1EEEE for ; Mon, 9 Jan 2023 07:16:45 -0800 (PST) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp03.blacknight.com (Postfix) with ESMTPS id EA77EC0D20 for ; Mon, 9 Jan 2023 15:16:43 +0000 (GMT) Received: (qmail 15870 invoked from network); 9 Jan 2023 15:16:43 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPA; 9 Jan 2023 15:16:43 -0000 From: Mel Gorman To: Linux-MM Cc: Andrew Morton , Michal Hocko , NeilBrown , Thierry Reding , Matthew Wilcox , Vlastimil Babka , LKML , Mel Gorman Subject: [PATCH 0/6 v2] Discard __GFP_ATOMIC Date: Mon, 9 Jan 2023 15:16:24 +0000 Message-Id: <20230109151631.24923-1-mgorman@techsingularity.net> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog since v1 o Split one patch (vbabka) o Improve OOM reserve handling (vbabka) o Fix __GFP_RECLAIM vs __GFP_DIRECT_RECLAIM (vbabka) Neil's patch has been residing in mm-unstable as commit 2fafb4fe8f7a ("mm: discard __GFP_ATOMIC") for a long time and recently brought up again. Most recently, I was worried that __GFP_HIGH allocations could use high-order atomic reserves which is unintentional but there was no response so lets revisit -- this series reworks how min reserves are used, protects highorder reserves and then finishes with Neil's patch with very minor modifications so it fits on top. There was a review discussion on renaming __GFP_DIRECT_RECLAIM to __GFP_ALLOW_BLOCKING but I didn't think it was that big an issue and is ortogonal to the removal of __GFP_ATOMIC. There were some concerns about how the gfp flags affect the min reserves but it never reached a solid conclusion so I made my own attempt. The series tries to iron out some of the details on how reserves are used. ALLOC_HIGH becomes ALLOC_MIN_RESERVE and ALLOC_HARDER becomes ALLOC_NON_BLOCK and documents how the reserves are affected. For example, ALLOC_NON_BLOCK (no direct reclaim) on its own allows 25% of the min reserve. ALLOC_MIN_RESERVE (__GFP_HIGH) allows 50% and both combined allows deeper access again. ALLOC_OOM allows access to 75%. High-order atomic allocations are explicitly handled with the caveat that no __GFP_ATOMIC flag means that any high-order allocation that specifies GFP_HIGH and cannot enter direct reclaim will be treated as if it was GFP_ATOMIC. Documentation/mm/balance.rst | 2 +- drivers/iommu/tegra-smmu.c | 4 +- include/linux/gfp_types.h | 12 ++-- include/trace/events/mmflags.h | 1 - lib/test_printf.c | 8 +-- mm/internal.h | 15 ++++- mm/page_alloc.c | 103 ++++++++++++++++++++------------- tools/perf/builtin-kmem.c | 1 - 8 files changed, 86 insertions(+), 60 deletions(-) -- 2.35.3