[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aW5NDEuP_pRLsq9d@thinkstation>
Date: Mon, 19 Jan 2026 15:26:37 +0000
From: Kiryl Shutsemau <kas@...nel.org>
To: Muchun Song <muchun.song@...ux.dev>
Cc: Oscar Salvador <osalvador@...e.de>, Mike Rapoport <rppt@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Zi Yan <ziy@...dia.com>, Baoquan He <bhe@...hat.com>, Michal Hocko <mhocko@...e.com>,
Johannes Weiner <hannes@...xchg.org>, Jonathan Corbet <corbet@....net>, kernel-team@...a.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>, David Hildenbrand <david@...nel.org>,
Matthew Wilcox <willy@...radead.org>, Usama Arif <usamaarif642@...il.com>,
Frank van der Linden <fvdl@...gle.com>
Subject: Re: [PATCHv3 09/15] mm/hugetlb: Refactor code around vmemmap_walk
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
Powered by blists - more mailing lists