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 2B5ABC433EF for ; Tue, 19 Oct 2021 06:59:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C567061212 for ; Tue, 19 Oct 2021 06:59:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C567061212 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 4ED1D900002; Tue, 19 Oct 2021 02:59:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49D136B0071; Tue, 19 Oct 2021 02:59:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33DBD900002; Tue, 19 Oct 2021 02:59:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id 21BEA6B006C for ; Tue, 19 Oct 2021 02:59:35 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B31AA8249980 for ; Tue, 19 Oct 2021 06:59:34 +0000 (UTC) X-FDA: 78712286268.30.1EFAEB4 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf29.hostedemail.com (Postfix) with ESMTP id CBEFD900024E for ; Tue, 19 Oct 2021 06:59:31 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8524B2197E; Tue, 19 Oct 2021 06:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1634626772; 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=tWUYrvYFsmqj0rtE1yYDBB9n74JxtnDP+Db2R7/QIZk=; b=aOKILhuQ3bfvUS+uulyoyUwQPgpO7HbSEhf/Qg6dySM8FGEpcm+k1lR28mAXp0HBTon9vL 8PkJYte5qeY7ri2k3Wvd1FWSq26EnbEBoc/DjuHwYSl5NRnjE3+RmqAybogg6PvMoZGXPb AGUfeDziG1cpHLYVPK7hNtwMMjRq3HA= 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 53C49A3B81; Tue, 19 Oct 2021 06:59:32 +0000 (UTC) Date: Tue, 19 Oct 2021 08:59:30 +0200 From: Michal Hocko To: NeilBrown Cc: linux-mm@kvack.org, Dave Chinner , Andrew Morton , Christoph Hellwig , Uladzislau Rezki , linux-fsdevel@vger.kernel.org, LKML , Ilya Dryomov , Jeff Layton Subject: Re: [RFC 1/3] mm/vmalloc: alloc GFP_NO{FS,IO} for vmalloc Message-ID: References: <20211018114712.9802-1-mhocko@kernel.org> <20211018114712.9802-2-mhocko@kernel.org> <163460424165.17149.585825289709126969@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <163460424165.17149.585825289709126969@noble.neil.brown.name> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CBEFD900024E X-Stat-Signature: 9199g6nkogjo5jw78smjc8q95pagxu9s Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=aOKILhuQ; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf29.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1634626771-131417 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 19-10-21 11:44:01, Neil Brown wrote: > On Mon, 18 Oct 2021, Michal Hocko wrote: [...] > > @@ -2930,8 +2932,24 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, > > goto fail; > > } > > > > - if (vmap_pages_range(addr, addr + size, prot, area->pages, > > - page_shift) < 0) { > > + /* > > + * page tables allocations ignore external gfp mask, enforce it > > + * by the scope API > > + */ > > + if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO) > > + flags = memalloc_nofs_save(); > > + else if (!(gfp_mask & (__GFP_FS | __GFP_IO))) > > I would *much* rather this were written > > else if ((gfp_mask & (__GFP_FS | __GFP_IO)) == 0) Sure, this looks better indeed. > so that the comparison with the previous test is more obvious. Ditto > for similar code below. > It could even be > > switch (gfp_mask & (__GFP_FS | __GFP_IO)) { > case __GFP__IO: flags = memalloc_nofs_save(); break; > case 0: flags = memalloc_noio_save(); break; > } > > But I'm not completely convinced that is an improvement. I am not a great fan of this though. > In terms of functionality this looks good. Thanks for the review! -- Michal Hocko SUSE Labs