From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1940A36164D for ; Mon, 19 Jan 2026 15:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768836405; cv=none; b=bBZN4I76taVSpxZ6ImNkgF9LKN/5XtlgXIu7yg89TxwyBCvBo8WTduEZlbu44mmldvi4ycgKNFu1MlUC6gaj7BdW/T0WcOtyM9oR4uPMvN6jpykMqruFFa+HN1YeCL9GzAa3Q7c2tQV719Onkhs196oq+M8ln19cYAIq7DDSQmo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768836405; c=relaxed/simple; bh=KIfEZnvVSwR/fdHFcIyoOb+BmBvRKs+lPm5Ma8PC1uA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p5fFdDthxeW224AGXxk9oU/kJPHLdlOSYObMX2/G7GZzISKEEsLLFFf2Zr7LKIWDZj2CEejPeN6UPo7/zGk2uTimR4DXdYgw05uBrOy923lZxctgnvBAaT8d2JmjBIQjJVLoo6AfYA9g5NI0rvA3Rxn0EBF7lOU7RJVzmUBjCTg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cG984jl6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cG984jl6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D9EEC4AF09; Mon, 19 Jan 2026 15:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768836404; bh=KIfEZnvVSwR/fdHFcIyoOb+BmBvRKs+lPm5Ma8PC1uA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cG984jl6D/GEEetT9pBTvZTdcko1whE9z3iBD/BY/wqNGpAgsobpXI485O16FsDAf Hc+sYrgaOf6rNcK2r+1dwWNGhVeI8FNu/kvsF89sEUKwQNhX5rqxKPAX7QFVTNcOmg 0Y989hTcpSMd0k6zucQQSy7UN+LCRLIsbCPW9oCLl5BytedKZVuIoPvXyRV9Xiiv0T 5b89Vmj2kEbNgjcBIqNMtqsz2qKLyk4Yr1DhaOwulhw80s0P9mmcyrO8Avtxk5q56s 6oQV12fy3kxdg6zTbDRGHBBg+JcXa9RCYAtSubQuqQvk9FDt3WPu3jgDn7pBKTc+fj HQfud4hALedwQ== Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfauth.phl.internal (Postfix) with ESMTP id 6C75AF4006A; Mon, 19 Jan 2026 10:26:43 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 19 Jan 2026 10:26:43 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufeejledvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpefmihhrhihl ucfuhhhuthhsvghmrghuuceokhgrsheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtth gvrhhnpeeigfdvtdekveejhfehtdduueeuieekjeekvdfggfdtkeegieevjedvgeetvdeh gfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehkih hrihhllhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqudeiudduiedvieeh hedqvdekgeeggeejvdekqdhkrghspeepkhgvrhhnvghlrdhorhhgsehshhhuthgvmhhovh drnhgrmhgvpdhnsggprhgtphhtthhopeefkedpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtohepmhhutghhuhhnrdhsohhngheslhhinhhugidruggvvhdprhgtphhtthhopehosh grlhhvrgguohhrsehsuhhsvgdruggvpdhrtghpthhtoheprhhpphhtsehkvghrnhgvlhdr ohhrghdprhgtphhtthhopehvsggrsghkrgesshhushgvrdgtiidprhgtphhtthhopehloh hrvghniihordhsthhorghkvghssehorhgrtghlvgdrtghomhdprhgtphhtthhopeiiihih sehnvhhiughirgdrtghomhdprhgtphhtthhopegshhgvsehrvgguhhgrthdrtghomhdprh gtphhtthhopehmhhhotghkohesshhushgvrdgtohhmpdhrtghpthhtohephhgrnhhnvghs segtmhhpgigthhhgrdhorhhg X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Jan 2026 10:26:41 -0500 (EST) Date: Mon, 19 Jan 2026 15:26:37 +0000 From: Kiryl Shutsemau To: Muchun Song Cc: Oscar Salvador , Mike Rapoport , Vlastimil Babka , Lorenzo Stoakes , Zi Yan , Baoquan He , Michal Hocko , Johannes Weiner , Jonathan Corbet , kernel-team@meta.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Andrew Morton , David Hildenbrand , Matthew Wilcox , Usama Arif , Frank van der Linden Subject: Re: [PATCHv3 09/15] mm/hugetlb: Refactor code around vmemmap_walk Message-ID: References: <20260115144604.822702-1-kas@kernel.org> <20260115144604.822702-10-kas@kernel.org> <72e04317-913e-4db1-89ed-61727bbdd01e@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <72e04317-913e-4db1-89ed-61727bbdd01e@linux.dev> On Mon, Jan 19, 2026 at 06:04:32PM +0800, Muchun Song wrote: > > @@ -415,29 +377,27 @@ static int alloc_vmemmap_page_list(unsigned long start, unsigned long end, > > * to remap. > > * @end: end address of the vmemmap virtual address range that we want to > > * remap. > > - * @reuse: reuse address. > > * @flags: modifications to vmemmap_remap_walk flags > > * > > * Return: %0 on success, negative error code otherwise. > > */ > > static int vmemmap_remap_alloc(unsigned long start, unsigned long end, > > - unsigned long reuse, unsigned long flags) > > + unsigned long flags) > > { > > LIST_HEAD(vmemmap_pages); > > struct vmemmap_remap_walk walk = { > > .remap_pte = vmemmap_restore_pte, > > - .reuse_addr = reuse, > > + .vmemmap_start = start, > > .vmemmap_pages = &vmemmap_pages, > > .flags = flags, > > }; > > - /* See the comment in the vmemmap_remap_free(). */ > > - BUG_ON(start - reuse != PAGE_SIZE); > > + start += HUGETLB_VMEMMAP_RESERVE_SIZE; > > From the @start comment above this function, we can see that the @start > address is the starting address for the remap operation we want to perform. > However, the modification here does not conform to the semantics here. > Therefore, I suggest letting the caller __hugetlb_vmemmap_restore_folio() > pass the correct parameters itself. > > The reason we previously used the reuse address here is that the > initialization of ->reuse_page was inside vmemmap_pte_entry. Now, > ->reuse_page has been removed in your patch. Fair enough. > > @@ -466,18 +425,16 @@ static int __hugetlb_vmemmap_restore_folio(const struct hstate *h, > > if (flags & VMEMMAP_SYNCHRONIZE_RCU) > > synchronize_rcu(); > > + vmemmap_start = (unsigned long)folio; > > (unsigned long)&folio->page?The folio is the metadata for contiguous pages, > while the page is our optimization target. Although their values are the > same now, their semantics are different. Okay. -- Kiryl Shutsemau / Kirill A. Shutemov