From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1672D369985; Wed, 27 May 2026 12:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779884121; cv=none; b=fe5VxYg/MaxqgLOlwLHXCvVGbIXKL6mGPRQBqmOC95jtB5ecSIT4tMNzLWJq3yrHK5XQEBeJXZtnYnelg8DYwZo75WSXDIY2l0SW7sRCY8nprts+PA4ASqoueOFDtS2TxAS/9Jvy8kaUgeGjzo+XzAV85jqJNoQG+7emC3E0yUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779884121; c=relaxed/simple; bh=N8F0SDC93Sd1AUmPlfRcn5p6y3asul968Ud3/vvAM/E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ixaIJZpZAtCV23nseidSzls50MSB4UVEbmwq0VXBBlH38ah4Xt1kC5RZExd0gKaNIZR9rprErUh+Wpfb5f+XekZM6PmieDMwzg+IVU7tdjC6YaWY2rRu50z4LVf9rKY4CNorOLmPL9wgErOPChxcNJEgegFDNdM4wu/sguKV3HM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 6183B68BEB; Wed, 27 May 2026 14:15:09 +0200 (CEST) Date: Wed, 27 May 2026 14:15:08 +0200 From: Christoph Hellwig To: Zi Yan Cc: Christoph Hellwig , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Chuck Lever , "Matthew Wilcox (Oracle)" , linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: revisiting alloc_pages_bulks semantics? Message-ID: <20260527121508.GA6079@lst.de> References: <20260527071816.GA17632@lst.de> <20260527080056.GA20040@lst.de> <2759BB06-005F-41EF-815F-C9F96E822DE1@nvidia.com> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2759BB06-005F-41EF-815F-C9F96E822DE1@nvidia.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Wed, May 27, 2026 at 04:31:24PM +0800, Zi Yan wrote: > > Yes, which is really odd, as other page/folio allocators make that an > > opt-in through GFP flags. > > Based on my understanding of the code, the GFP flags are respected at > the __alloc_pages_noprof() in alloc_pages_bulk(). As __alloc_pages_noprof is the core of the regular page/folio allocator I'd expect that as well. > The loop of > rmqueue_pcplist() is just a quick try of getting free pages. > And I suspect it might be quicker than calling __alloc_pages_noprof() > in a loop, since other preparation work in __alloc_pages_noprof() > is only done once. Possibly. But that means a whole bunch of callers have the wrong assumption. > > Well, I really want them. In some cases I might be fine falling down > > to smaller sizes, but I also really don't want the logic in every > > caller. > > Based on your answers above, it sounds like a wrapper of > __alloc_pages_bulk() that doing allocation in a loop until all requested > pages are filled might be good enough for your case. > > But let me know if I miss something. Or just allocate all pages using a loop when alloc_pages_bulk_noprof doesn't get enough pages from the PCP list? > > The allocations I have in mind would only require try hard allocations > > for typical file system blocks sizes (64k at most), while eveything > > larger is fair game for falling back. > > Sure. In MM, PAGE_ALLOC_COSTLY_ORDER is 3, so pages bigger than that > would take more effort to get and the allocation latency can be longer. > So it might take a long time to allocate the last 64KB page in > a bulk allocation. Based on the LSF/MM session on lage folios and MM fragmentation session it seems like we should raise it to 4 for 4k page size platforms, as this seems to be a proble for 64k folio allocations.