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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AB5FC433F5 for ; Tue, 5 Oct 2021 09:20:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C23B86159A for ; Tue, 5 Oct 2021 09:20:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C23B86159A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 59FCC6B006C; Tue, 5 Oct 2021 05:20:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54FE36B0071; Tue, 5 Oct 2021 05:20:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43E306B0072; Tue, 5 Oct 2021 05:20:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id 348D06B006C for ; Tue, 5 Oct 2021 05:20:54 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DA95131E65 for ; Tue, 5 Oct 2021 09:20:53 +0000 (UTC) X-FDA: 78661839186.25.F2A8397 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf01.hostedemail.com (Postfix) with ESMTP id 7582A5074900 for ; Tue, 5 Oct 2021 09:20:53 +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-out2.suse.de (Postfix) with ESMTPS id 59A8B1FFFB; Tue, 5 Oct 2021 09:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1633425652; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mf8VJfVMIA+k3Bsw/G2xHgLY8J7xFCmSVY3uxV1UuE0=; b=ousjmab2qPFeIHEyaA7FI4cVaHn6d2U1WkOqmsNx571ZG9fss2RfjzhZ8M2XbZxFeNoJut KkYSX089bN7jIbrTgOwwXYFMwvWswTBP/vi8h3HbkHe2KkEykNTk7WTzhHZ5CClMXJP+2e 0wG6YtaEosgYvr/jFZA+2QKduI2z/d8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1633425652; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mf8VJfVMIA+k3Bsw/G2xHgLY8J7xFCmSVY3uxV1UuE0=; b=1SXNJ+3yLxZznTYY6j5SXI3wv8HosWt7G25kBydvsEv+oBV7oAdP/MKz5tZF1x3YWKGM2B d5dtPPwK3UTu7ZCQ== 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 1753713C1B; Tue, 5 Oct 2021 09:20:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VxndBPQYXGHkfQAAMHmgww (envelope-from ); Tue, 05 Oct 2021 09:20:52 +0000 Message-ID: Date: Tue, 5 Oct 2021 11:20:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: [PATCH 2/6] MM: improve documentation for __GFP_NOFAIL Content-Language: en-US To: NeilBrown , Andrew Morton , Theodore Ts'o , Andreas Dilger , "Darrick J. Wong" , Matthew Wilcox , Mel Gorman , Michal Hocko , ". Dave Chinner" , Jonathan Corbet Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org References: <163184698512.29351.4735492251524335974.stgit@noble.brown> <163184741778.29351.16920832234899124642.stgit@noble.brown> From: Vlastimil Babka In-Reply-To: <163184741778.29351.16920832234899124642.stgit@noble.brown> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 7582A5074900 X-Stat-Signature: cwaxqg763w1sjr9efn14azp7yk988xhy Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ousjmab2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=1SXNJ+3y; spf=pass (imf01.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam06 X-HE-Tag: 1633425653-481327 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 9/17/21 04:56, NeilBrown wrote: > __GFP_NOFAIL is documented both in gfp.h and memory-allocation.rst. > The details are not entirely consistent. > > This patch ensures both places state that: > - there is a risk of deadlock with reclaim/writeback/oom-kill > - it should only be used when there is no real alternative > - it is preferable to an endless loop > - it is strongly discourages for costly-order allocations. > > Signed-off-by: NeilBrown Acked-by: Vlastimil Babka Nit below: > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index 55b2ec1f965a..1d2a89e20b8b 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -209,7 +209,11 @@ struct vm_area_struct; > * used only when there is no reasonable failure policy) but it is > * definitely preferable to use the flag rather than opencode endless > * loop around allocator. > - * Using this flag for costly allocations is _highly_ discouraged. > + * Use of this flag may lead to deadlocks if locks are held which would > + * be needed for memory reclaim, write-back, or the timely exit of a > + * process killed by the OOM-killer. Dropping any locks not absolutely > + * needed is advisable before requesting a %__GFP_NOFAIL allocate. > + * Using this flag for costly allocations (order>1) is _highly_ discouraged. We define costly as 3, not 1. But sure it's best to avoid even order>0 for __GFP_NOFAIL. Advising order>1 seems arbitrary though? > */ > #define __GFP_IO ((__force gfp_t)___GFP_IO) > #define __GFP_FS ((__force gfp_t)___GFP_FS) > > >