From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
<linux-mm@kvack.org>
Cc: Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
<Liam.Howlett@oracle.com>
Subject: Re: [PATCH 2/3] mm: mprotect: avoid unnecessary struct page accessing if pte_protnone()
Date: Tue, 14 Oct 2025 16:02:44 +0800 [thread overview]
Message-ID: <364ceb89-6327-498a-9582-bb1fbe2bd98e@huawei.com> (raw)
In-Reply-To: <93736a75-3fc5-47b0-8985-96e1b0b98b8a@redhat.com>
On 2025/10/14 15:16, David Hildenbrand wrote:
>>>
>>>> + if (prot_numa && pte_protnone(oldpte))
>>>> + continue;
>>>> +
>>>> page = vm_normal_page(vma, addr, oldpte);
>>>> if (page)
>>>> folio = page_folio(page);
>>>
>>> I could have sworn we discussed that while fixing the prot_numa_skip()
>>> fallout.
>>
>> I'm not follow the thread, but we found that vm_normal_page does
>> introduce regression for mprotect benchmark(libMicro) with
>> this vm_normal_page().
>>
>
> Right, I raised it here:
>
> https://lkml.kernel.org/r/aa496798-5ac6-4cb0-bdc2-91515172e935@redhat.com
Thanks for the links, let's fix it now ;)
>
> I questioned how relevant it would be in practice.
>
> I'm surprised it shows up in a mprotect() benchmark: mprotect() itself
> would never be able to set MM_CP_PROT_NUMA, so the code wold not
> actually be executed.
>
Sorry, my description is very clear, the regression is not about prot
numa, I mean the vm_normal_page does introduce some regression when
mprotect benchmark in libMicro, before cac1db8c3aad ("mm: optimize
mprotect() by PTE batching"), we only call vm_normal_page in
can_change_pte_writable(), but now it is unconditional called and
10% regression in some libMicro mprotect benchmark.
We could add limit to call of vm_normal_page, eg,cp_flags
check, and using pte_batch_hint, but it is unclear whether it is worth
doing so.
next prev parent reply other threads:[~2025-10-14 8:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 12:15 [PATCH 0/3] mm: some optimizations for prot numa Kefeng Wang
2025-10-13 12:15 ` [PATCH 1/3] mm: mprotect: always skip dma pinned folio in prot_numa_skip() Kefeng Wang
2025-10-13 15:12 ` Sidhartha Kumar
2025-10-13 15:49 ` David Hildenbrand
2025-10-14 1:42 ` Lance Yang
2025-10-13 12:15 ` [PATCH 2/3] mm: mprotect: avoid unnecessary struct page accessing if pte_protnone() Kefeng Wang
2025-10-13 15:22 ` Sidhartha Kumar
2025-10-13 15:53 ` David Hildenbrand
2025-10-14 6:06 ` Kefeng Wang
2025-10-14 7:16 ` David Hildenbrand
2025-10-14 8:02 ` Kefeng Wang [this message]
2025-10-14 8:56 ` David Hildenbrand
2025-10-14 9:19 ` Kefeng Wang
2025-10-13 12:15 ` [PATCH 3/3] mm: huge_memory: use prot_numa_skip() for pmd folio Kefeng Wang
2025-10-13 15:41 ` Sidhartha Kumar
2025-10-13 15:58 ` David Hildenbrand
2025-10-14 6:10 ` Kefeng Wang
2025-10-14 7:24 ` David Hildenbrand
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=364ceb89-6327-498a-9582-bb1fbe2bd98e@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=ryan.roberts@arm.com \
--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