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 EFD9BC433F5 for ; Thu, 18 Nov 2021 23:15:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 858AB61A89 for ; Thu, 18 Nov 2021 23:15:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 858AB61A89 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B4B636B0072; Thu, 18 Nov 2021 18:14:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AFB276B0073; Thu, 18 Nov 2021 18:14:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A12976B0074; Thu, 18 Nov 2021 18:14:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id 911486B0072 for ; Thu, 18 Nov 2021 18:14:54 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4ABA65ACE6 for ; Thu, 18 Nov 2021 23:14:44 +0000 (UTC) X-FDA: 78823607688.28.48A77DD Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf13.hostedemail.com (Postfix) with ESMTP id CC66C1052675 for ; Thu, 18 Nov 2021 23:14:42 +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 B7FA52170E; Thu, 18 Nov 2021 23:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1637277282; 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=J+T3+AC//U32S54eK96JFxe6YTH+QG23o+QTpg+MWBg=; b=XiKNcVmND/Ld3xDzCaAuxhxLIKgm9SjvNpw/hrNAkpgSHKsmOhVHqsjDlKaWcRS1S0+Q26 wjADst+RlW59NFmkq8c3JLEY8e+tSOG6l1eh4gQj6DXbx8EVsIJv1NYk0SamuyMoCIFd56 bl7rt3uCnF67MGim+hyXRdHdpDlmCes= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1637277282; 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=J+T3+AC//U32S54eK96JFxe6YTH+QG23o+QTpg+MWBg=; b=Kqvgpf2EVq7491a6MDAqZpjOdxlHpX9e8EOIvWYInXIc4ymEowqynCeYp16u507ZR1URQh LBb5a/Y4TuYWeDCA== 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 DE63713AA8; Thu, 18 Nov 2021 23:14:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id v5PrJmDelmG5QAAAMHmgww (envelope-from ); Thu, 18 Nov 2021 23:14:40 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Matthew Wilcox" Cc: "Andrew Morton" , "Michal Hocko" , "Thierry Reding" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] MM: discard __GFP_ATOMIC In-reply-to: References: <163712397076.13692.4727608274002939094@noble.neil.brown.name>, Date: Fri, 19 Nov 2021 10:14:38 +1100 Message-id: <163727727803.13692.15470049610672496362@noble.neil.brown.name> X-Stat-Signature: o9q3q1w3dmwn8xspdoco4h1scju6d46u Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=XiKNcVmN; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Kqvgpf2E; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf13.hostedemail.com: domain of neilb@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=neilb@suse.de X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CC66C1052675 X-HE-Tag: 1637277282-79583 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 Thu, 18 Nov 2021, Matthew Wilcox wrote: > On Wed, Nov 17, 2021 at 03:39:30PM +1100, NeilBrown wrote: > > +++ b/drivers/iommu/tegra-smmu.c > > @@ -676,12 +676,12 @@ static struct page *as_get_pde_page(struct tegra_sm= mu_as *as, > > * allocate page in a sleeping context if GFP flags permit. Hence > > * spinlock needs to be unlocked and re-locked after allocation. > > */ > > - if (!(gfp & __GFP_ATOMIC)) > > + if (gfp & __GFP_DIRECT_RECLAIM) > > spin_unlock_irqrestore(&as->lock, *flags); > > =20 > > page =3D alloc_page(gfp | __GFP_DMA | __GFP_ZERO); > > =20 > > - if (!(gfp & __GFP_ATOMIC)) > > + if (gfp & __GFP_DIRECT_RECLAIM) > > spin_lock_irqsave(&as->lock, *flags); > > =20 > > /* >=20 > Surely this should be gfpflags_allow_blocking() instead of poking about > in the innards of gfp flags? Possibly. Didn't know about gfpflags_allow_blocking(). From a quick grep in the kernel, a whole lot of other people don't know about it either, though clearly some do. Maybe we should reaname "__GFP_DIRECT_RECLAIM" to "__GFP_ALLOW_BLOCKING", because that is what most users seems to care about. If not, then we probably want a gfpflags_without_block() function that removes that flag, as lots of code wants to do that - and using the flag for one, and an inline for the other is not consistent. My leaning would be to __GFP_ALLOW_BLOCKING NeilBrown >=20 > This patch seems like a good simplification to me. >=20 > Reviewed-by: Matthew Wilcox (Oracle) Thanks, NeilBrown