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 1EED6C433EF for ; Tue, 5 Oct 2021 12:27:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0511561215 for ; Tue, 5 Oct 2021 12:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234888AbhJEM3j (ORCPT ); Tue, 5 Oct 2021 08:29:39 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:52934 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234401AbhJEM3i (ORCPT ); Tue, 5 Oct 2021 08:29:38 -0400 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 054E220020; Tue, 5 Oct 2021 12:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1633436866; 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=JjGOU28aseIxzbgxmKKGBf+lfKA8napnrkp1mk29VtE=; b=Bzpre7weOsXJ/u0YLszAyXJT5NP2OpWOG4HD0n3NXs9HPxWb/XUtF8fVLg5+g0fPQL7LIJ J+ePJ6f5kRNWYMjcrWW79ogSqTmH18OMCLxa5kV7b9ZPYN+22E9C2nckip1BhlQLaiO4EX QPHzankMnoMtHNaLmhKTwWqqdxyCKDk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1633436866; 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=JjGOU28aseIxzbgxmKKGBf+lfKA8napnrkp1mk29VtE=; b=JcXixsvED2f4ufImevKRnrpIhO7jiSyFefYaC+44w0N5Nf8Va0GlAZnYmtiF0is3Ufq1tf FDf4ReDNhB2Fa1AQ== 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 B2EE113C50; Tue, 5 Oct 2021 12:27:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aGXfKsFEXGHXawAAMHmgww (envelope-from ); Tue, 05 Oct 2021 12:27:45 +0000 Message-ID: Date: Tue, 5 Oct 2021 14:27:45 +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: Michal Hocko Cc: NeilBrown , Andrew Morton , Theodore Ts'o , Andreas Dilger , "Darrick J. Wong" , Matthew Wilcox , Mel Gorman , ". Dave Chinner" , Jonathan Corbet , 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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 10/5/21 13:09, Michal Hocko wrote: > On Tue 05-10-21 11:20:51, Vlastimil Babka wrote: > [...] >> > --- 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? > > This is not completely arbitrary. We have a warning for any higher order > allocation. > rmqueue: > WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1)); Oh, I missed that. > I do agree that "Using this flag for higher order allocations is > _highly_ discouraged. Well, with the warning in place this is effectively forbidden, not just discouraged. >> > */ >> > #define __GFP_IO ((__force gfp_t)___GFP_IO) >> > #define __GFP_FS ((__force gfp_t)___GFP_FS) >> > >> > >> > >