From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 236A3C38145 for ; Tue, 6 Sep 2022 07:35:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B12F18025E; Tue, 6 Sep 2022 03:35:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC17480224; Tue, 6 Sep 2022 03:35:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 961D18025E; Tue, 6 Sep 2022 03:35:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 83CE080224 for ; Tue, 6 Sep 2022 03:35:44 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 561218064F for ; Tue, 6 Sep 2022 07:35:44 +0000 (UTC) X-FDA: 79880851008.01.47B4452 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf29.hostedemail.com (Postfix) with ESMTP id DBFC11200A6 for ; Tue, 6 Sep 2022 07:35:43 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B4B0C33756; Tue, 6 Sep 2022 07:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1662449742; 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=aMlGqlnQ04JpTCGyz8Bgtjox+j1YdblTUnCI6z5C09I=; b=S36G2qUkHSLI+DSrxUIL+5u1S7DL2CSRctUzbiZ6dItoP0G0FlBXlo726UDvA4+A5TZDrw SSjaksADSLg3ye7OpO7VEmP/2Ii7wx/1wSWkmuRch1EpnhUO8uaI4PDY1HFo1pjViV7sGk +blFRGsRK5MvybcM2UF6x5a7W9YSWds= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 95BE113A7A; Tue, 6 Sep 2022 07:35:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6A6FIk74FmNLOQAAMHmgww (envelope-from ); Tue, 06 Sep 2022 07:35:42 +0000 Date: Tue, 6 Sep 2022 09:35:41 +0200 From: Michal Hocko To: Andrew Morton Cc: NeilBrown , Thierry Reding , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mel Gorman , Vlastimil Babka Subject: Re: [PATCH] MM: discard __GFP_ATOMIC Message-ID: References: <163712397076.13692.4727608274002939094@noble.neil.brown.name> <163764199967.7248.2528204111227925210@noble.neil.brown.name> <20220430113028.9daeebeedf679aa384da5945@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220430113028.9daeebeedf679aa384da5945@linux-foundation.org> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662449744; a=rsa-sha256; cv=none; b=QUcf+upXEh7TkuO0ZDza6EGaWDVsKfHsiUTGaKeEbjjButUJ0n27n5UtDaVdiYCNBfmaLu O0HS2K0W5jIg0dGK3ks7DsyZUj2xG5KtjA+usX6V3h2aatPGTp2QnaxIzSM3lFazQr++pR UPQk9UUzxoa+sle1OmqCOwg7IZIxri4= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=S36G2qUk; spf=pass (imf29.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662449744; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aMlGqlnQ04JpTCGyz8Bgtjox+j1YdblTUnCI6z5C09I=; b=Ref68fcWkp8kaRA3K/0neARmejsMqHhBz754rNNNffhVTfdW31Lk8vSmxBWVjn6ukNcemq cUjzxTghPsgBMB+LEcnQeLSX7Vtfxww3rNm43MgHYGaz4HVE6zaf0iV7qPAECFSDuPB4Yc bg2aFQOwo1PlDkGlzoKYYggXBk+cJco= Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=S36G2qUk; spf=pass (imf29.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam01 X-Rspam-User: X-Stat-Signature: 9gqm43tyq759ot7re7xky9uqrm19ffy8 X-Rspamd-Queue-Id: DBFC11200A6 X-HE-Tag: 1662449743-595032 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: On Sat 30-04-22 11:30:28, Andrew Morton wrote: Sorry, this got lost in my inbox. Thanks Andrew for poking me. > From: "NeilBrown" > Subject: mm: discard __GFP_ATOMIC > > __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 > - causes __GFP_HIGH to set ALLOC_HARDER unless __GFP_NOMEMALLOC is set > (as well as ALLOC_HIGH). > - 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. This is a good summary of the current usage and existing issues. It also shows that the naming is tricky and allows people to make wrong calls (tegra-smmu.c). I also thing that it is wrong to couple memory reserves access to the reclaim constrains/expectations of the caller. > Link: https://lkml.kernel.org/r/163712397076.13692.4727608274002939094@noble.neil.brown.name > Signed-off-by: NeilBrown > Reviewed-by: Matthew Wilcox (Oracle) > Cc: Michal Hocko > Cc: Thierry Reding > Cc: Mel Gorman > Signed-off-by: Andrew Morton Yes, I am all for dropping the gfp flag. One thing that is not really entirely clear to me, though, is whether we still need 3 levels of memory reserves access. Can we just drop ALLOC_HARDER? With this patch applied it serves RT tasks and conflates it with __GFP_HIGH users essentially. So why do we need that additional level of reserves? -- Michal Hocko SUSE Labs