From: "zhangpeng (AS)" <zhangpeng362@huawei.com>
To: Mike Kravetz <mike.kravetz@oracle.com>,
Matthew Wilcox <willy@infradead.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<akpm@linux-foundation.org>, <muchun.song@linux.dev>,
<sidhartha.kumar@oracle.com>, <vishal.moola@gmail.com>,
<wangkefeng.wang@huawei.com>, <sunnanyong@huawei.com>
Subject: Re: [PATCH 2/2] mm/hugetlb: Use a folio in hugetlb_wp()
Date: Mon, 5 Jun 2023 19:15:08 +0800 [thread overview]
Message-ID: <0e567e11-e735-d092-afac-b2a3106d3f9b@huawei.com> (raw)
In-Reply-To: <20230602205239.GB3941@monkey>
On 2023/6/3 4:52, Mike Kravetz wrote:
> On 06/02/23 21:17, Matthew Wilcox wrote:
>> On Fri, Jun 02, 2023 at 09:54:08AM +0800, Peng Zhang wrote:
>>> From: ZhangPeng <zhangpeng362@huawei.com>
>>>
>>> We can replace nine implict calls to compound_head() with one by using
>>> old_folio. However, we still need to keep old_page because we need to
>>> know which page in the folio we are copying.
>> Do we? It's my understanding (and I am far from an expert here ...)
>> that the 'pte_t *' we are passed *inside hugetlbfs* is not in fact a pte
>> pointer at all but actually a pmd or pud pointer.
> That may not be technically true in some arch specific cases such as
> arm64 with CONT_PTES and CONT_PMDS.
>
>> See how we do this:
>>
>> pte_t pte = huge_ptep_get(ptep);
>>
>> and so the page we get back is always a head page, and we can go
>> directly to a folio. ie this is different from the THP cases.
> However, it is true that ptep will always be associated with the head
> page. This is because the associated virtual address is hugetlb page
> aligned.
>
> So, I agree with Matthew that there is no need to keep old_page.
> Note that if old_page was NOT the head page, then
>
> copy_user_huge_page(&new_folio->page, old_page, address, vma,
> pages_per_huge_page(h));
>
> would write beyond the end of range as it assumes old_page is head.
Agreed. I'll send a v2 soon. Thanks.
Best Regards,
Peng
next prev parent reply other threads:[~2023-06-05 11:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 1:54 [PATCH 0/2] Convert two functions in hugetlb.c to use a folio Peng Zhang
2023-06-02 1:54 ` [PATCH 1/2] mm/hugetlb: Use a folio in copy_hugetlb_page_range() Peng Zhang
2023-06-02 3:14 ` Muchun Song
2023-06-02 16:44 ` Sidhartha Kumar
2023-06-02 1:54 ` [PATCH 2/2] mm/hugetlb: Use a folio in hugetlb_wp() Peng Zhang
2023-06-02 3:17 ` Muchun Song
2023-06-02 17:47 ` Sidhartha Kumar
2023-06-02 20:17 ` Matthew Wilcox
2023-06-02 20:52 ` Mike Kravetz
2023-06-05 11:15 ` zhangpeng (AS) [this message]
2023-06-05 11:15 ` zhangpeng (AS)
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=0e567e11-e735-d092-afac-b2a3106d3f9b@huawei.com \
--to=zhangpeng362@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=sidhartha.kumar@oracle.com \
--cc=sunnanyong@huawei.com \
--cc=vishal.moola@gmail.com \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.org \
/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®