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 A444BC433EF for ; Mon, 22 Nov 2021 16:44:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D3F06B006C; Mon, 22 Nov 2021 11:43:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 983446B0072; Mon, 22 Nov 2021 11:43:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84B9A6B0073; Mon, 22 Nov 2021 11:43:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 741E86B006C for ; Mon, 22 Nov 2021 11:43:46 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 107A481022D9 for ; Mon, 22 Nov 2021 16:43:36 +0000 (UTC) X-FDA: 78837137232.31.B87D252 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf15.hostedemail.com (Postfix) with ESMTP id D786CD0000A8 for ; Mon, 22 Nov 2021 16:43:31 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 2419F1FD39; Mon, 22 Nov 2021 16:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1637599414; 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=IIkJYdNyfdkaPaDy9R4nQfQdmmgHCH9vNQA4fsbQjFw=; b=cGZefgA0WGWcPBgMQqXdMf3Lxo7T8hzTTz6UNDZ6ZofCAsSfzmOnUnAZ+dwFHh6/KwCYHG oennkooysXTRDDE3tMI0zi7W6FCRCZznhvToIMh+EbWpBckHLLUC75Wc5KCjzD03yet92p xyJbFGhnGY5Gw4Q3i23wn8v76jYeU4o= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D9900A3B85; Mon, 22 Nov 2021 16:43:33 +0000 (UTC) Date: Mon, 22 Nov 2021 17:43:33 +0100 From: Michal Hocko To: NeilBrown Cc: Andrew Morton , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <163712397076.13692.4727608274002939094@noble.neil.brown.name> X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D786CD0000A8 X-Stat-Signature: xm8tp6bszaf6ba7anx3obhp8dpekosy1 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=cGZefgA0; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf15.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1637599411-956566 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 Wed 17-11-21 15:39:30, Neil Brown wrote: > > __GFP_ATOMIC serves little purpose. > It's 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. While I like to see __GFP_ATOMIC going away I am not really sure about this particular part. We have 3 ways to get to memory reserves. One of thme is directly controlable by __GFP_HIGH and two are internal to the allocator to handle different situations - ALLOC_OOM is to help the oom victim to make a fwd progress and ALLOC_HARDER should be for contexts which cannot rely on the memory reclaim to continue. What is the point of having ALLOC_HIGH and ALLOC_HARDER if you just add both of them for __GFP_HIGH? I think you should be instead really get back to pre d0164adc89f6b and allow ALLOC_HARDER for requests which have neither of the reclaim allowed. That would require tweaking GFP_ATOMIC as well I suspect and drop __GFP_KSWAPD_RECLAIM. Or do something else. > __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. I believe the point of the warning was to stop any abuse of an additional memory reserves for context which can reclaim and to spare those to interrupt handlers - which usually use GFP_ATOMIC. A lack of any reports suggests this hasn't happened and the warning can be dropped. Would be worth a patch on its own with this explanation. > __GFP_ATOMIC allows the "watermark_boost" to be side-stepped. It is > probable that testing ALLOC_HARDER is a better fit here. This has been introduced by f80b08fc44536 but I have to say that I haven't understood why this couldn't check for __GFP_DIRECT_RECLAIM or one ALLOC_$FOO boosters rather than __GFP_ATOMIC. Again something for a separate patch. > __GFP_ATOMIC is used by tegra-smmu.c to check if the allocation might > sleep. This should test __GFP_DIRECT_RECLAIM instead. Willy has already proposed a better alternative. Thanks! -- Michal Hocko SUSE Labs