From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
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 v4 3/4] mm: mprotect: convert to folio_needs_prot_numa()
Date: Tue, 21 Oct 2025 16:41:22 +0800 [thread overview]
Message-ID: <3ee89484-9cdf-4c50-a5db-79b9f2ca6886@huawei.com> (raw)
In-Reply-To: <759578b3-d582-48cc-90af-491210ecd90f@lucifer.local>
On 2025/10/21 2:56, Lorenzo Stoakes wrote:
> On Mon, Oct 20, 2025 at 08:12:08PM +0200, David Hildenbrand wrote:
>> On 20.10.25 19:49, Lorenzo Stoakes wrote:
>>> On Mon, Oct 20, 2025 at 07:34:51PM +0200, David Hildenbrand wrote:
>>>> On 20.10.25 17:14, Kefeng Wang wrote:
>>>>>
>>>>>
>>>>> On 2025/10/20 21:10, Lorenzo Stoakes wrote:
>>>>>> On Mon, Oct 20, 2025 at 02:18:44PM +0800, Kefeng Wang wrote:
>>>>>>> The prot_numa_skip() naming is not good since it updates the folio
>>>>>>> access time except checking whether to skip prot NUMA, so rename it
>>>>>>> to folio_needs_prot_numa(), and cleanup it a bit, remove ret by
>>>>>>
>>>>>> Hmm not sure 'folio_needs_prot_numa()' is any better in terms of indicating
>>>>>> that you're updating the access time to be honest.
>>>>>>
>>>>>> Also it seems to suggest that you're determining whether a mapping of the
>>>>>> folio should be made a NUMA hint by the folio alone rather than the reality
>>>>>> that the mapping is being considered for NUMA hinting and you're checking
>>>>>> to see if you actually have to do it.
>>>>
>>>> ... because the folio doesn't need prot_none protection for NUMA hitning? :)
>>>
>>> folio_xxx() impliles to me that the folio independently has proeprty 'xxx'.
>>>
>>
>> I would agree if it would be a folio_has_* or folio_test_*.
>
> folio_is_zone_device()
> folio_is_zone_movable()
> folio_needs_release()
> folio_needs_cow_for_dma()
> folio_memcg_kmem()
> folio_memcg_charged()
> folio_pgoff()
> folio_pos()
> folio_contains()
> folio_mapcount()
>
> etc. etc. etc.
>
> All properties of the folio in particular, not folio_has_*() or folio_test_*().
>
> I mean the pattern is established in the kernel. Including folio_needs_*()!
>
> I honestly wonder if the original formulation was correct - check for exemptions.
>
> So something like folio_exempt_from_prot_numa()?
>
> Or this way around folio_suitable_prot_numa()?
>
> I think this is an English thing. 'folio needs prot numa' reads as 'this folio
> _needs_ prot numa' right?
>
> Oh - folio_can_map_prot_numa()? Something like this?
>
>>
>> To me the folio is really just the main entity we are querying information
>> about. Not the VMA, not the target node, but the folio.
>
> OK, I guess folio_needs_cow_for_dma() does the same thing with MMF_HAS_PINNED.
>
>>
>>> So it's like saying 'here's a folio, does it NEED prot numa?' right?
>>
>> I'd say: "here is a folio, does it need numa protection in this vma". So I
>> still don't understand your point, unfortunately.
>
> Again I think it's an English thing. As I said above.
>
>>
>> And keep disliking prot_numa_hint_needed() ;)
>
> Well you are very particular about naming :)
>
> I similarly dislike folio_needs_prot_numa()...
>
Maybe folio_needs_protnone_mapping()? if there are no better options,
we'll leave it as is.
>>
>> But again, I won't fight for it if you have strong opinions on it.
>
> It's not the biggest issue in the world. Equally if you insist I won't lose
> sleep over this...
>
>>
>> It would be better if we could have discussed that as part of v2 to avoid
>> having Kefeng go back and forth. Maybe v3+v4 were sent out a bit too quickly
>
> At v2 I had just got back from holiday (+ being sick) and had a >1,000 mail
> backlog, sorry.
>
>>
>> --
>> Cheers
>>
>> David / dhildenb
>>
>>
>
> Cheers, Lorenzo
>
next prev parent reply other threads:[~2025-10-21 8:41 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 6:18 [PATCH v4 0/4] mm: some optimizations for prot numa Kefeng Wang
2025-10-20 6:18 ` [PATCH v4 1/4] mm: mprotect: always skip dma pinned folio in prot_numa_skip() Kefeng Wang
2025-10-21 3:06 ` Barry Song
2025-10-20 6:18 ` [PATCH v4 2/4] mm: mprotect: avoid unnecessary struct page accessing if pte_protnone() Kefeng Wang
2025-10-20 12:53 ` Lorenzo Stoakes
2025-10-20 13:08 ` David Hildenbrand
2025-10-20 6:18 ` [PATCH v4 3/4] mm: mprotect: convert to folio_needs_prot_numa() Kefeng Wang
2025-10-20 13:09 ` David Hildenbrand
2025-10-20 13:10 ` Lorenzo Stoakes
2025-10-20 15:14 ` Kefeng Wang
2025-10-20 17:34 ` David Hildenbrand
2025-10-20 17:49 ` Lorenzo Stoakes
2025-10-20 18:12 ` David Hildenbrand
2025-10-20 18:56 ` Lorenzo Stoakes
2025-10-21 8:41 ` Kefeng Wang [this message]
2025-10-21 9:13 ` David Hildenbrand
2025-10-21 9:25 ` Lorenzo Stoakes
2025-10-21 9:45 ` Lorenzo Stoakes
2025-10-21 12:54 ` Kefeng Wang
2025-10-21 14:56 ` Lorenzo Stoakes
2025-10-21 15:01 ` David Hildenbrand
2025-10-21 16:36 ` Lorenzo Stoakes
2025-10-22 0:51 ` Kefeng Wang
2025-10-20 6:18 ` [PATCH v4 4/4] mm: huge_memory: use folio_needs_prot_numa() for pmd folio Kefeng Wang
2025-10-20 13:11 ` David Hildenbrand
2025-10-20 13:15 ` Lorenzo Stoakes
2025-10-20 13:23 ` David Hildenbrand
2025-10-20 15:18 ` Kefeng Wang
2025-10-21 13:37 ` Kefeng Wang
2025-10-21 15:35 ` Lorenzo Stoakes
2025-10-21 15:29 ` Lorenzo Stoakes
2025-10-22 1:33 ` Kefeng 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=3ee89484-9cdf-4c50-a5db-79b9f2ca6886@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