From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 D295633688D for ; Thu, 16 Jul 2026 06:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784184559; cv=none; b=pOm231zhK1zbhB8ES+cKNqc1TiLRsFsglKiTrD4pUlwbbJqYRdSaAXuriS5YOGu/VjYDtWOnohG3KebivHNXWLDbsRLcHktuwy3gxhRFf/IABzCBYoOXTh9ikz/xUzfYPJqYzA/5+iSnCfz3msMDcF9gt12ArbU7PSTyAPr50T8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784184559; c=relaxed/simple; bh=F+4y4MlfzcoH9CZV0gNLGAHZxMGd2cpU+Wm1+84sMvs=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=kDRR4HmkyY228ACvmZObFwGMRyNUCE8se0ayCZPpiyZNgIG+jhDr4DET2kwS5NjLFhTNj6aMuyzjNPNgHlsX6HQucgukRHZXKgnY18ZCv/5N/xxGPMeieDNVM7yxKEyNTxsNCxbbyb6CHtsPHvGGzdwuyZF1zpa7J4kR8XPKuZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Y9kmFDAD; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Y9kmFDAD" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784184554; h=from:from:reply-to:subject:subject: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=HuJ0eR+6kGcKYPrRrf2xbFLQzaW7WpnHjaOAMZHOJ7E=; b=Y9kmFDADiY/YNm6eRavTb0DaJtzt2cKjAAtHBwqmL141Y1n9ZsxSviaTLvlOaTrHhXlTA7 N9hKsz3qx3iAPnHWU5dTEf/odXZqb7+N/RZdhVagz8INFZAj4s3xvG6WNiOr9rhsGpXsub qmKu1mNP89rpkSmL5t7hZAIW/MhJCQ4= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: [PATCH 06/17] mm/sparse-vmemmap: support section-based vmemmap accounting X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: Date: Thu, 16 Jul 2026 14:48:47 +0800 Cc: Muchun Song , Andrew Morton , Oscar Salvador , David Hildenbrand , linux-mm@kvack.org, Vlastimil Babka , Lorenzo Stoakes , Michal Hocko , linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <773AD6C9-322F-4633-8F4E-E96384D793D8@linux.dev> References: <20260702093821.2740183-1-songmuchun@bytedance.com> <20260702093821.2740183-7-songmuchun@bytedance.com> <178409212283.638342.6610895811767474932.b4-review@b4> To: Mike Rapoport X-Migadu-Flow: FLOW_OUT Sorry, there is some problem issue with my email, let me sent again. > On Jul 16, 2026, at 14:23, Mike Rapoport wrote: >=20 > On Wed, Jul 15, 2026 at 10:44:51PM +0800, Muchun Song wrote: >>> On Jul 15, 2026, at 13:08, Mike Rapoport wrote: >>>=20 >>>> section_nr_vmemmap_pages() is used to account the vmemmap pages = consumed by a >>>> memory section, but it currently only understands the ordinary case = and the >>>> pgmap-provided optimization case. That is not enough for = section-based vmemmap >>>> optimization, where the compound page order is carried by the = memory section >>>> itself and tail vmemmap pages may be shared. >>>>=20 >>>> Make the helper report the actual vmemmap footprint of a section, = so it can be >>>> used as the common accounting path for both ordinary and optimized = sections. >>>>=20 >>>> Teach section_nr_vmemmap_pages() to use the section order when = there is no >>>> pgmap, and to account only the vmemmap pages that are actually = needed for an >>>> optimizable section. This keeps the accounting consistent with = section-based >>>> vmemmap optimization. >>>>=20 >>>> Signed-off-by: Muchun Song >>>>=20 >>>> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h >>>> index 6fa6e7f0abf9..41a1ebbe5e85 100644 >>>> --- a/include/linux/mmzone.h >>>> +++ b/include/linux/mmzone.h >>>> @@ -2403,6 +2403,14 @@ static inline unsigned int = section_order(const struct mem_section *section) >>>> } >>>> #endif >>>>=20 >>>> +static inline bool section_vmemmap_optimizable(const struct = mem_section *section) >>>> +{ >>>> + if (!is_power_of_2(sizeof(struct page))) >>>> + return false; >>>> + >>>> + return section_order(section) >=3D OPTIMIZABLE_FOLIO_MIN_ORDER; >>>=20 >>> Like with page_vmemmap_optimizable() I think it's not obvious that >>> section_order() is enough to gate vmemmap optimization. >>=20 >> page_vmemmap_optimizable() checks the optimizability of an individual = page. >> section_vmemmap_optimizable() checks whether the optimization can be = applied >> to a section. Some people may think that = section_vmemmap_optimizable() checks >> the optimizability of all pages within an entire section. You are = referring >> to that ambiguity, right? >>=20 >> What do you think about renaming it to = section_vmemmap_optimization_eligible()? >> Would that clear up the ambiguity? Or should we add a comment to >> section_vmemmap_optimizableto explain its purpose? >=20 > The name is fine, IMHO. > What I meant is that it would be clearer if there was a check for > HUGETLB_PAGE_OPTIMIZE_VMEMMAP. Thanks for your clarification, Mike. Muchun. >=20 > --=20 > Sincerely yours, > Mike.