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 06F89C433FE for ; Tue, 5 Oct 2021 11:10:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9F65F6120C for ; Tue, 5 Oct 2021 11:10:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9F65F6120C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 28E466B006C; Tue, 5 Oct 2021 07:10:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 23E7D6B0071; Tue, 5 Oct 2021 07:10:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12D66900002; Tue, 5 Oct 2021 07:10:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id 008A76B006C for ; Tue, 5 Oct 2021 07:10:02 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B401E180278AE for ; Tue, 5 Oct 2021 11:10:02 +0000 (UTC) X-FDA: 78662114244.12.B99FB4B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf03.hostedemail.com (Postfix) with ESMTP id 2C9693000CA9 for ; Tue, 5 Oct 2021 11:10:02 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id AED1322312; Tue, 5 Oct 2021 11:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1633432200; 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=oSQVXrxwytTOvVX5IUNIPqRozXx0ZQPzC5QYUn5uXWU=; b=pKrrhANTXeIml7kLM167UDYZbKQyQXPNx3t/wOQIs1bfleWEq3LCE9k4OBQTOerJBWWswL edtifxt35dK99ea2K/VGTfMZkCE+nWuLDDSSwDUhdTSrdw+ZZZwtkVbcrPmQAoVsnjeUiw 4MB2uWI2IDResdUN+s8kZrM8jqeP3DU= 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 6A9C7A3B84; Tue, 5 Oct 2021 11:10:00 +0000 (UTC) Date: Tue, 5 Oct 2021 13:09:56 +0200 From: Michal Hocko To: Vlastimil Babka 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 Subject: Re: [PATCH 2/6] MM: improve documentation for __GFP_NOFAIL Message-ID: References: <163184698512.29351.4735492251524335974.stgit@noble.brown> <163184741778.29351.16920832234899124642.stgit@noble.brown> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2C9693000CA9 X-Stat-Signature: p3e78gfinto565gothohynfez8j8siyo Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=pKrrhANT; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf03.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1633432202-924993 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 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)); I do agree that "Using this flag for higher order allocations is _highly_ discouraged. > > */ > > #define __GFP_IO ((__force gfp_t)___GFP_IO) > > #define __GFP_FS ((__force gfp_t)___GFP_FS) > > > > > > -- Michal Hocko SUSE Labs