Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp776043rwb; Fri, 13 Jan 2023 04:07:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXsdmzKNZzMTLLQQ6maTNGY76lsoqd3/qeJ3Xggi2DIBTEwQA/nUX9qVN3JIwCJSx9OaQ7rb X-Received: by 2002:a17:906:6a91:b0:844:d342:3566 with SMTP id p17-20020a1709066a9100b00844d3423566mr59482335ejr.22.1673611659062; Fri, 13 Jan 2023 04:07:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673611659; cv=none; d=google.com; s=arc-20160816; b=E2MYOdh+v8Bzs7JqBQK1wE27NicODRQmbEOVrxiqqrG2AT6iwpjY1ZtQE7tLHQvq3J m+KsdKykiv/XRsgDbKLNHF2KgIs+yuMviYrNZSkkwmCgSUyR5AxWXDiOymQotzqH3lcX jznH4772ucCCYyZtCDbKhlmrooDkp/UrfsagoKc4knhfse8rQT1GU3b8gO0SeWZF28a/ ISromPNg7h62o7Uvc/F3DH8Zsa7u0K9i0yMMuKfYseLO5mzHwML6usZWfsCZFkVOES3F HRGPdC8apfxaALWPi/7N/v1zIidEZi2ddBa5yTIMEfhpHtHwBPo8TFib1wGtWUIM0ddX tGdA== 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=4OVqnDrxBC309ljmSktuxy8fSvNEHvAFGZQQGyvJuPA=; b=0+v43SccAiulH3oCtlLvcGaMxf/FUx7HejLFONHxx0Xh5nB4vB0a98TLO6OCdgXpKx 4IHcPwCCq45FwmgsLbq+6Hg7vcbka5c9C5CZ0IWNv4Ky/5kIGceX2hb2L47F2iW5l8qx Gew/WZFHH/MIZzmbVuYTlXM6YbcVinFEd66V/sMzRspiKa1eg7xEx90Iy13q/cFUNUdu bSAig+whMPSCH6wa+gSYKqD+7kf0EIkoLlQCUOKob0b5iIFwPK4882PH4YWmnIBYy77G exCom7RHIf4wO70YJpahAOEeA0s5jzpLKmtZp/LoZ5OR7JUZsvlSMjz8WDkagH2NJNbt Pa2w== 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 he14-20020a1709073d8e00b0085d6d5c0de2si10354406ejc.593.2023.01.13.04.07.26; Fri, 13 Jan 2023 04:07:39 -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 S241542AbjAMLRi (ORCPT + 51 others); Fri, 13 Jan 2023 06:17:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239679AbjAMLQn (ORCPT ); Fri, 13 Jan 2023 06:16:43 -0500 Received: from outbound-smtp24.blacknight.com (outbound-smtp24.blacknight.com [81.17.249.192]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0013A7A3B6 for ; Fri, 13 Jan 2023 03:12:29 -0800 (PST) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp24.blacknight.com (Postfix) with ESMTPS id 35A4BC0D92 for ; Fri, 13 Jan 2023 11:12:28 +0000 (GMT) Received: (qmail 8319 invoked from network); 13 Jan 2023 11:12:28 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPA; 13 Jan 2023 11:12:27 -0000 From: Mel Gorman To: Andrew Morton Cc: Michal Hocko , NeilBrown , Thierry Reding , Matthew Wilcox , Vlastimil Babka , Linux-MM , LKML , Mel Gorman Subject: [PATCH 0/6 v3] Discard __GFP_ATOMIC Date: Fri, 13 Jan 2023 11:12:11 +0000 Message-Id: <20230113111217.14134-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 This replaces the "Discard __GFP_ATOMIC v2" series in mm-unstable. There are changelog and patch replacements that make -fix patches impractical. Changelog since v2 o Non-blocking (GFP_NOWAIT) allocations get no reserve access (mhocko) o __GFP_NOFAIL before OOM reserve access reduced (mhocko) o Changelog clarifications (mhocko) o Note that rt_task treatment to be deleted in changelog (mhocko) o One ack dropped as the patch changed enough to invalidate it 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 | 106 ++++++++++++++++++++------------- tools/perf/builtin-kmem.c | 1 - 8 files changed, 88 insertions(+), 61 deletions(-) -- 2.35.3