Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2125128rwl; Fri, 6 Jan 2023 02:10:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXsMiNtLj03TjiZh0Xj+d9xEqpic8tTrIr6QKDMBxw0O6BObNOPvEAzjylzkYC9DEeNEUZAT X-Received: by 2002:a17:906:b119:b0:7ff:727f:65cb with SMTP id u25-20020a170906b11900b007ff727f65cbmr46251249ejy.19.1672999829634; Fri, 06 Jan 2023 02:10:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672999829; cv=none; d=google.com; s=arc-20160816; b=lr/yqtEPXcC46Vr3hRuLg4gSfHOmR+ZLKG/z9FmgSKTeFQjBm+0xil+BH6G+L4buzP 1PDM6Vu/FuyCdr+EGs3Zvt4+SBryRiN+bMReplnJAIbqpgZ+2MZrRnbEv7ru2R5VUj8e C19JIm/ghe8awr1nyeUUNMx0/zTIskDdSRK3/ybXd3pEg49gTL89CibCWpL22SEHw0Pt E6h7s8gSq5a1oV7BuoQmomAAvTUMPARfisRdD9uGaePcgrABL+zaHcIE7cCKKRo6NDpn 2mvqpwSDJYu9491Nxe1GNqLjBSpMnljtOGRpeWMPhdJQVptavmaUX0o8yDEyar946MR4 drbw== 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; bh=vp0tFF8JO8nH2VBvMDQhdtgp+NoGLXyG2XI3+WXN+30=; b=ne9vFY10qtm5wJKLEnVdjZgpaoiFzp4QcIgPwi93R9Ct688MT9ed5wNBawICTYILeQ VsLVGZJiWtXaQm/p19o5UvBNnpa7n2KuB5EiT/77soe9dP2u7GIwcSKo6OAkxDZOid93 HpFOSbMNPWMnkOuJCYYCBGJRPKW5xn4ZSXCbYvlDQb2UAnq2oEXAM2geBT3UlPjWzNrf HvslnBjIJzK6JollcPgdgezCcrSa3zZf2g8pSOhM+s8GixijPN/cu8+ju1+iRR5Fgn51 4ReJR0X7b+nMCuP+qienMTqfStQxWKKzIBBLsi1Sernv1rvI9SFlQXbWLOh5bLSOgiCL r3Vg== 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 ft31-20020a170907801f00b0084d1a2c5a06si593453ejc.925.2023.01.06.02.10.16; Fri, 06 Jan 2023 02:10:29 -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 S233677AbjAFJlH (ORCPT + 54 others); Fri, 6 Jan 2023 04:41:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbjAFJkh (ORCPT ); Fri, 6 Jan 2023 04:40:37 -0500 Received: from outbound-smtp55.blacknight.com (outbound-smtp55.blacknight.com [46.22.136.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFE0D6CFDF for ; Fri, 6 Jan 2023 01:35:28 -0800 (PST) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp55.blacknight.com (Postfix) with ESMTPS id 3B123FAAF6 for ; Fri, 6 Jan 2023 09:35:27 +0000 (GMT) Received: (qmail 300 invoked from network); 6 Jan 2023 09:35:27 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 6 Jan 2023 09:35:27 -0000 Date: Fri, 6 Jan 2023 09:35:24 +0000 From: Mel Gorman To: Mike Rapoport Cc: Linux-MM , Andrew Morton , Michal Hocko , NeilBrown , Thierry Reding , Matthew Wilcox , Vlastimil Babka , LKML Subject: Re: [PATCH 6/6] mm: discard __GFP_ATOMIC Message-ID: <20230106093524.ck5otyaopd724een@techsingularity.net> References: <20221129151701.23261-1-mgorman@techsingularity.net> <20221129151701.23261-7-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: 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 On Thu, Jan 05, 2023 at 03:49:44PM +0200, Mike Rapoport wrote: > Hi Mel, > > On Tue, Nov 29, 2022 at 03:17:01PM +0000, Mel Gorman wrote: > > From: NeilBrown > > > > __GFP_ATOMIC serves little purpose. Its main effect is to set > > ALLOC_HARDER which adds a few little boosts to increase the chance of an > > allocation succeeding, one of which is to lower the water-mark at which it > > will succeed. > > > > It is *always* paired with __GFP_HIGH which sets ALLOC_HIGH which also > > adjusts this watermark. It is probable that other users of __GFP_HIGH > > should benefit from the other little bonuses that __GFP_ATOMIC gets. > > > > __GFP_ATOMIC also gives a warning if used with __GFP_DIRECT_RECLAIM. > > There is little point to this. We already get a might_sleep() warning if > > __GFP_DIRECT_RECLAIM is set. > > > > __GFP_ATOMIC allows the "watermark_boost" to be side-stepped. It is > > probable that testing ALLOC_HARDER is a better fit here. > > > > __GFP_ATOMIC is used by tegra-smmu.c to check if the allocation might > > sleep. This should test __GFP_DIRECT_RECLAIM instead. > > > > This patch: > > - removes __GFP_ATOMIC > > - allows __GFP_HIGH allocations to ignore watermark boosting as well > > as GFP_ATOMIC requests. > > - makes other adjustments as suggested by the above. > > > > The net result is not change to GFP_ATOMIC allocations. Other > > allocations that use __GFP_HIGH will benefit from a few different extra > > privileges. This affects: > > xen, dm, md, ntfs3 > > the vermillion frame buffer > > hibernation > > ksm > > swap > > all of which likely produce more benefit than cost if these selected > > allocation are more likely to succeed quickly. > > > > [mgorman: Minor adjustments to rework on top of a series] > > Link: https://lkml.kernel.org/r/163712397076.13692.4727608274002939094@noble.neil.brown.name > > Signed-off-by: NeilBrown > > Signed-off-by: Mel Gorman > > --- > > Documentation/mm/balance.rst | 2 +- > > Documentation/core-api/memory-allocation.rst needs an update as well, and > there are other mentions of GFP_ATOMIC in Documentation/ > What part do you think needs updating in that file? There are two references to GFP_ATOMIC in that file, one about accessing reserves and another about non-sleeping allocations and the accuracy does not change after the series. If anything, this statement should change because it invites GFP_ATOMIC abuse for spurious reasons * If you think that accessing memory reserves is justified and the kernel will be stressed unless allocation succeeds, you may use ``GFP_ATOMIC``. There are other references to GFP_ATOMIC in Documentation/ that are are a little inaccurate but not in a way that is harmful and is not changed by the series. For example; GFP_ATOMIC requests are kernel internal allocations that must be satisfied, immediately. The kernel may drop some request, in rare cases even panic, if a GFP_ATOMIC alloc fails. This is a stronger statement than GFP_ATOMIC deserves but it's close enough in the given context. -- Mel Gorman SUSE Labs