From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 CE09C3A257A for ; Thu, 16 Jul 2026 10:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784196263; cv=none; b=WIXYKixQVdoW12e4cTKEmEEpLKTOqEvLoDZ3b/fReEEUZPc2kZaPHB2qKLz8kABML0XV/8DnkSZCl+ESK0nDNODCKJjl8w6VrUQhSMaZJSmIET5YpeobNHLFN3Ys80Rv0ormGGJSZjO8/C6hZP9qV33PWrIwCwWxbPu3+mIWMX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784196263; c=relaxed/simple; bh=KQIjPqdEzjkc9Otvls0WI9IzoFhoHJpYo48zXEAMgt0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=U4YkeHgZjW+PkDO6Nq0aHlQMGH0EdH9s2fZxkm310wKZPDNtYN43sEepwm4EaJ5Cro3bI5BXGw8vryF4Z/kcPTyNSwyq9QZE8JMK3Hp/ZedhMnMmUASCPrlcc8roDT17rcqPnhtT8QINC9FhqEtNlg/EKGqgKJUCTYEytJ5YgEc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eAetlT4J; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eAetlT4J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 354351F000E9; Thu, 16 Jul 2026 10:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784196262; bh=UTxY20JRNMDjjwC3TnDgutzXYpe1bjDRCYv9Axou7cE=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=eAetlT4Jh3U2xXlCshsUo6vQglpSj3+wEI8i9n6KyBg+BbJdS1T6xbX2of4k/TLTJ 7EzPwEIYan2BmoGltWwiz/dp9kVGg8Fc2Q4KFwIvghFqpTkqOc9fhotod/UbdfJZrp iKyGXiXC6CVyZ5E/mTIUEb82WRP3+43ChPn7xm0gZ6uBzfNfPZ5pqL41FP6SzqZ/9B O0Zi8fy1S5kyRma2J94QiM7uUylU7moEr8hnq04SJDKa/gYovWCuWgSdmccdHBLrhI FrcO8wv+QB9+6uZzrJeZUVdbkVwwM1b3A89ohcwFJFcSYcQkilx0vt46LhUWr90wVw uUiW7RYwWnmcA== Date: Thu, 16 Jul 2026 13:04:17 +0300 From: Mike Rapoport To: Muchun Song Cc: Andrew Morton , Oscar Salvador , David Hildenbrand , linux-mm@kvack.org, Vlastimil Babka , Lorenzo Stoakes , Michal Hocko , linux-kernel@vger.kernel.org, Muchun Song Subject: Re: [PATCH 03/17] mm/sparse-vmemmap: introduce folio-oriented vmemmap optimization macros Message-ID: References: <20260702093821.2740183-1-songmuchun@bytedance.com> <20260702093821.2740183-4-songmuchun@bytedance.com> <178409212283.638342.14256193145803309214.b4-review@b4> <8dab2dd9-1e0e-4254-b46c-cfe7a12cdea3@linux.dev> 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: <8dab2dd9-1e0e-4254-b46c-cfe7a12cdea3@linux.dev> On Thu, Jul 16, 2026 at 03:38:59PM +0800, Muchun Song wrote: > > > On 2026/7/15 13:08, Mike Rapoport wrote: > > > Introduce macros for those folio-oriented properties and use them to > > > replace the tail-based names in the HVO paths. This makes the code read > > > in terms of folio semantics instead of an implementation detail and > > > better matches other folio-based users such as DAX. > > > > > > No functional change intended. > > > > > > Signed-off-by: Muchun Song > > > > > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > > > index bacd89572c5c..ea884245f499 100644 > > > --- a/include/linux/mmzone.h > > > +++ b/include/linux/mmzone.h > > > @@ -107,13 +107,15 @@ > > > is_power_of_2(sizeof(struct page)) ? \ > > > MAX_FOLIO_NR_PAGES * sizeof(struct page) : 0) > > > -/* > > > - * vmemmap optimization (like HVO) is only possible for page orders that fill > > > - * two or more pages with struct pages. > > > - */ > > > -#define VMEMMAP_TAIL_MIN_ORDER (ilog2(2 * PAGE_SIZE / sizeof(struct page))) > > > -#define __NR_VMEMMAP_TAILS (MAX_FOLIO_ORDER - VMEMMAP_TAIL_MIN_ORDER + 1) > > > -#define NR_VMEMMAP_TAILS (__NR_VMEMMAP_TAILS > 0 ? __NR_VMEMMAP_TAILS : 0) > > > +/* The number of vmemmap pages required by a vmemmap-optimized folio. */ > > > +#define OPTIMIZED_FOLIO_VMEMMAP_PAGES 1 > > > +#define OPTIMIZED_FOLIO_VMEMMAP_SIZE (OPTIMIZED_FOLIO_VMEMMAP_PAGES * PAGE_SIZE) > > > +#define OPTIMIZED_FOLIO_VMEMMAP_NR_STRUCT_PAGES (OPTIMIZED_FOLIO_VMEMMAP_SIZE / sizeof(struct page)) > > > +#define OPTIMIZABLE_FOLIO_MIN_ORDER (ilog2(OPTIMIZED_FOLIO_VMEMMAP_NR_STRUCT_PAGES) + 1) > > > + > > > +#define __NR_OPTIMIZABLE_FOLIO_ORDERS (MAX_FOLIO_ORDER - OPTIMIZABLE_FOLIO_MIN_ORDER + 1) > > > +#define NR_OPTIMIZABLE_FOLIO_ORDERS \ > > > + (__NR_OPTIMIZABLE_FOLIO_ORDERS > 0 ? __NR_OPTIMIZABLE_FOLIO_ORDERS : 0) > > I can't say I like the new names, they read like some folio optimization > > rather than vmemmap optimization. > > > > I think they should be namespaced with VMEMMAP_ or even > > VMEMMAP_OPTIMIZATION_ (or VMEMMAP_OPT_) and should not mention folio. > > If you're okay with it, I'll update those macros to: > > VMEMMAP_OPTIMIZATION_NR_STRUCT_PAGES > VMEMMAP_OPTIMIZATION_MIN_ORDER > VMEMMAP_OPTIMIZATION_NR_ORDERS Sounds good :) > > I'd also drop intermediate defines OPTIMIZED_FOLIO_VMEMMAP_PAGES and > > OPTIMIZED_FOLIO_VMEMMAP_SIZE and use 1 and PAGE_SIZE directly. > > OK. I'll not introduce OPTIMIZED_FOLIO_VMEMMAP_PAGES and > OPTIMIZED_FOLIO_VMEMMAP_SIZE > > Muchun, > Thanks. -- Sincerely yours, Mike.