From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E71001A267 for ; Tue, 12 May 2026 13:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778591886; cv=none; b=WHPxZagD4J4goYy2izK/qfiIaHj1ZUyxKBHSKgMpteQoyJlwinqUZU0bof1FozJ7+DU42U83sF1vI4hJVc6wlj6OS+l8RfytLKh1JV2eTB7fjanjABorEFvs1jNk9DJJeVnMVj1z95Qoup2wdjklhuRKRDvGMhlGacau60EZ58k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778591886; c=relaxed/simple; bh=6gd+T5jJxaX1/8CL6E+vJdr3BZggFDTPbf0rrHIePfk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=D07VtfABHZnXx+uG7YhH+KMK+llosqUEB0v5D5xIIHxtTsn4xzsCOrGelWecEI9/ui36En+P1/OcH3ZvDzK3f4d+ALvLBa30/x9uROJyLlhGRinWQApyHSKJgC5exONEuWpMEsZw27S8XW5plQVrd5Xp3a9nkMvm5EI4frKCvkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=U0nleVlK; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=oIVcWN9O; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=U0nleVlK; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=oIVcWN9O; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="U0nleVlK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="oIVcWN9O"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="U0nleVlK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="oIVcWN9O" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 227A376204; Tue, 12 May 2026 13:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778591883; 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=suMYel1hUEuILupPXvkjppmiXwI9Yx6AJKPij/Mwk2o=; b=U0nleVlKAnB3tsHfRCgRC6dzgGot549EjqBJeTfQ8Nl6T4V9G1m4QKTyi+H43DFTYTouMt ig5qJsFMg6SY4e6PTnubBAexXnit6NFgAFmPKI2s74+IlPcRvOapyHNxvV6A17cxMI1Yvh rpYZA0+HNbXI8ndm4CBydR8lj/cDIdY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778591883; 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=suMYel1hUEuILupPXvkjppmiXwI9Yx6AJKPij/Mwk2o=; b=oIVcWN9OZYMKaCbOx89m3Hj6rdmlQNrMtPKQeuM4T8bvuZy9XG/1vyOxjRQa7OgZSBvOj/ hz49PCysV6otQlAg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778591883; 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=suMYel1hUEuILupPXvkjppmiXwI9Yx6AJKPij/Mwk2o=; b=U0nleVlKAnB3tsHfRCgRC6dzgGot549EjqBJeTfQ8Nl6T4V9G1m4QKTyi+H43DFTYTouMt ig5qJsFMg6SY4e6PTnubBAexXnit6NFgAFmPKI2s74+IlPcRvOapyHNxvV6A17cxMI1Yvh rpYZA0+HNbXI8ndm4CBydR8lj/cDIdY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778591883; 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=suMYel1hUEuILupPXvkjppmiXwI9Yx6AJKPij/Mwk2o=; b=oIVcWN9OZYMKaCbOx89m3Hj6rdmlQNrMtPKQeuM4T8bvuZy9XG/1vyOxjRQa7OgZSBvOj/ hz49PCysV6otQlAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E3289593A9; Tue, 12 May 2026 13:18:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aWv1NIkoA2oDSgAAD6G6ig (envelope-from ); Tue, 12 May 2026 13:18:01 +0000 Date: Tue, 12 May 2026 15:17:56 +0200 From: Oscar Salvador To: ackerleytng@google.com Cc: Muchun Song , David Hildenbrand , Andrew Morton , fvdl@google.com, jiaqiyan@google.com, joshua.hahnjy@gmail.com, jthoughton@google.com, mhocko@kernel.org, michael.roth@amd.com, pasha.tatashin@soleen.com, pbonzini@redhat.com, peterx@redhat.com, pratyush@kernel.org, rick.p.edgecombe@intel.com, rientjes@google.com, roman.gushchin@linux.dev, seanjc@google.com, shakeel.butt@linux.dev, shivankg@amd.com, vannapurve@google.com, yan.y.zhao@intel.com, Dan Williams , Jason Gunthorpe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/6] Open HugeTLB allocation routine for more generic use Message-ID: References: <20260506-hugetlb-open-up-v2-0-826a0c5f28fc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20260506-hugetlb-open-up-v2-0-826a0c5f28fc@google.com> X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,localhost.localdomain:mid]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[26]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[linux.dev,kernel.org,linux-foundation.org,google.com,gmail.com,amd.com,soleen.com,redhat.com,intel.com,ziepe.ca,kvack.org,vger.kernel.org]; TAGGED_RCPT(0.00)[]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLa1jia3o8a9x8abp87x6pc54n)]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,localhost.localdomain:mid] X-Spam-Flag: NO X-Spam-Score: -2.80 On Wed, May 06, 2026 at 08:54:36AM -0700, Ackerley Tng via B4 Relay wrote: > Hi, > > The motivation for this patch series is guest_memfd, which would like > to use HugeTLB as a generic source of huge pages but not adopt > HugeTLB's reservation at mmap() time. > > By refactoring alloc_hugetlb_folio() and some dependent functions, > there is now an option to allocate HugeTLB folios without providing a > VMA. Specifically, HugeTLB allocation used to be dependent on the VMA > to > > 1. Look up reservations in the resv_map > 2. Get mpol, stored at vma->vm_policy > > This refactoring provides hugetlb_alloc_folio(), which focuses on just > the allocation itself, and associated memory and HugeTLB charging > (cgroups). alloc_hugetlb_folio() still handles reservations in the > resv_map and subpools. > > Regarding naming, I'm definitely open to alternative names :) I chose > hugetlb_alloc_folio() because I'm seeing this function as a general > allocation function that is provided by the HugeTLB subsystem (hence > the hugetlb_ prefix). I'm intending for alloc_hugetlb_folio() to be > later refactored as a static function for use just by HugeTLB, and > HugeTLBfs should probably use hugetlb_alloc_folio() directly. > > To see how hugetlb_alloc_folio() is used by guest_memfd, the most > recent patch series that uses this more generic HugeTLB allocation > routine is at [1], and a newer revision of that patch series is at > [2]. Would that be https://lore.kernel.org/all/cover.1747264138.git.ackerleytng@google.com/T/#me2152fa2cc79d651ecea7a2bce8b57725fb57465 ? -- Oscar Salvador SUSE Labs