From: Matthew Wilcox <willy@infradead.org>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: akpm@linux-foundation.org, david@redhat.com, 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 2/2] mm: convert do_set_pmd() to take a folio
Date: Wed, 7 May 2025 17:47:10 +0100 [thread overview]
Message-ID: <aBuOjrH1UpyTf8I9@casper.infradead.org> (raw)
In-Reply-To: <88060373-d0b8-404a-b53b-9b5a54f5ba6f@linux.alibaba.com>
On Wed, May 07, 2025 at 08:36:54PM +0800, Baolin Wang wrote:
> On 2025/5/7 20:10, Matthew Wilcox wrote:
> > Because I see nowhere in this patch that you initialise 'page'.
>
> Please look at the following code in do_set_pmd(), and the 'page' will be
> initialized before using.
>
> if (thp_disabled_by_hw() || vma_thp_disabled(vma, vma->vm_flags))
> return ret;
>
> if (!thp_vma_suitable_order(vma, haddr, PMD_ORDER))
> return ret;
>
> if (folio_order(folio) != HPAGE_PMD_ORDER)
> return ret;
> page = &folio->page;
Ah, fair, I missed that.
> > And that's really the important part. You seem to be assuming that a
> > folio will never be larger than PMD size, and I'm not comfortable with
>
> No, I have no this assumption. But do_set_pmd() is used to establish PMD
> mappings for the PMD-sized folios, and we already have PMD-sized checks to
> validate the folio size:
>
> if (!thp_vma_suitable_order(vma, haddr, PMD_ORDER))
> return ret;
>
> if (folio_order(folio) != HPAGE_PMD_ORDER)
> return ret;
>
> > that assumption. It's a limitation I put in place a few years ago so we
> > didn't have to find and fix all those assumptions immediately, but I
> > imagine that some day we'll want to have larger folios.
> >
> > So unless you can derive _which_ page in the folio we want to map from
>
> IMO, for PMD mapping of a PMD-sized folio, we do not need to know _which_
> page in the folio we want to map, because we'll always map the entire
> PMD-sized folio.
There's a difference between "Assert that the folio is PMD sized" inside
the function because we know there are still problems, and "Change the
interface so we can't specify which page inside the folio is the one
we're actually interested in".
I reiterate the NACK to this patch.
next prev parent reply other threads:[~2025-05-07 16:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 9:26 [PATCH 1/2] mm: khugepaged: convert set_huge_pmd() " Baolin Wang
2025-05-07 9:26 ` [PATCH 2/2] mm: convert do_set_pmd() " Baolin Wang
2025-05-07 12:10 ` Matthew Wilcox
2025-05-07 12:36 ` Baolin Wang
2025-05-07 16:47 ` Matthew Wilcox [this message]
2025-05-08 2:23 ` Baolin Wang
2025-05-08 7:37 ` David Hildenbrand
2025-05-07 21:24 ` David Hildenbrand
2025-05-07 23:46 ` Zi Yan
2025-05-08 7:36 ` David Hildenbrand
2025-05-08 13:12 ` Matthew Wilcox
2025-05-07 12:04 ` [PATCH 1/2] mm: khugepaged: convert set_huge_pmd() " Matthew Wilcox
2025-05-07 21:19 ` David Hildenbrand
2025-05-08 2:08 ` 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=aBuOjrH1UpyTf8I9@casper.infradead.org \
--to=willy@infradead.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.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=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
all inboxes | Powered by JetHome®