[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4decbf69-23cd-4717-ad9b-3315a9df7b37@linux.alibaba.com>
Date: Mon, 12 May 2025 10:17:26 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: David Hildenbrand <david@...hat.com>, akpm@...ux-foundation.org,
willy@...radead.org
Cc: hannes@...xchg.org, lorenzo.stoakes@...cle.com, Liam.Howlett@...cle.com,
npache@...hat.com, ryan.roberts@....com, dev.jain@....com, ziy@...dia.com,
vbabka@...e.cz, rppt@...nel.org, surenb@...gle.com, mhocko@...e.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] mm: khugepaged: convert set_huge_pmd() to take a
folio
On 2025/5/9 22:58, David Hildenbrand wrote:
>> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
>> index b04b6a770afe..aca66e7f4fd9 100644
>> --- a/mm/khugepaged.c
>> +++ b/mm/khugepaged.c
>> @@ -1467,7 +1467,7 @@ static void collect_mm_slot(struct
>> khugepaged_mm_slot *mm_slot)
>> #ifdef CONFIG_SHMEM
>> /* hpage must be locked, and mmap_lock must be held */
>
> ^ that comment probably needs some love.
Ah, missed that. Will update the comments in next version.
>
>> static int set_huge_pmd(struct vm_area_struct *vma, unsigned long addr,
>> - pmd_t *pmdp, struct page *hpage)
>> + pmd_t *pmdp, struct folio *folio)
>> {
>> struct vm_fault vmf = {
>> .vma = vma,
>> @@ -1476,13 +1476,12 @@ static int set_huge_pmd(struct vm_area_struct
>> *vma, unsigned long addr,
>> .pmd = pmdp,
>> };
>> - VM_BUG_ON(!PageTransHuge(hpage));
>> mmap_assert_locked(vma->vm_mm);
>> - if (do_set_pmd(&vmf, hpage))
>> + if (do_set_pmd(&vmf, &folio->page))
>> return SCAN_FAIL;
>> - get_page(hpage);
>> + folio_get(folio);
>> return SCAN_SUCCEED;
>> }
>> @@ -1689,7 +1688,7 @@ int collapse_pte_mapped_thp(struct mm_struct
>> *mm, unsigned long addr,
>> maybe_install_pmd:
>> /* step 5: install pmd entry */
>> result = install_pmd
>> - ? set_huge_pmd(vma, haddr, pmd, &folio->page)
>> + ? set_huge_pmd(vma, haddr, pmd, folio)
>
> Wondering why we are not passing in the folio+page pair in here as well.
> I assume in the foreseeable future this code will not be able to work
> with folios large than PMDs?
OK. Will do in next version.
> Apart from that LGTM.
>
> Acked-by: David Hildenbrand <david@...hat.com>
Thanks.
Powered by blists - more mailing lists