From: David Hildenbrand <david@redhat.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>,
akpm@linux-foundation.org, willy@infradead.org
Cc: hannes@cmpxchg.org, lorenzo.stoakes@oracle.com,
Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com,
dev.jain@arm.com, ziy@nvidia.com, vbabka@suse.cz,
rppt@kernel.org, surenb@google.com, mhocko@suse.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mm: khugepaged: convert set_huge_pmd() to take a folio
Date: Fri, 9 May 2025 16:58:23 +0200 [thread overview]
Message-ID: <239471b5-12fe-4bad-a6e1-e9f0ad195ab5@redhat.com> (raw)
In-Reply-To: <bc3d4638747e8141133676069336d868c2b2d360.1746795452.git.baolin.wang@linux.alibaba.com>
> 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.
> 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?
Apart from that LGTM.
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-05-09 14:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 13:01 Baolin Wang
2025-05-09 13:01 ` [PATCH v2 2/2] mm: convert do_set_pmd() " Baolin Wang
2025-05-09 15:01 ` Zi Yan
2025-05-09 14:58 ` David Hildenbrand [this message]
2025-05-12 2:17 ` [PATCH v2 1/2] mm: khugepaged: convert set_huge_pmd() " Baolin Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=239471b5-12fe-4bad-a6e1-e9f0ad195ab5@redhat.com \
--to=david@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=npache@redhat.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox