From: David Hildenbrand <david@redhat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Oscar Salvador <osalvador@suse.de>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Zi Yan <ziy@nvidia.com>,
Matthew Brost <matthew.brost@intel.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>,
Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
Gregory Price <gourry@gourry.net>,
Ying Huang <ying.huang@linux.alibaba.com>,
Alistair Popple <apopple@nvidia.com>,
Pedro Falcato <pfalcato@suse.de>, Rik van Riel <riel@surriel.com>,
Harry Yoo <harry.yoo@oracle.com>
Subject: Re: [PATCH v1 2/4] mm: smaller folio_pte_batch() improvements
Date: Wed, 2 Jul 2025 11:11:15 +0200 [thread overview]
Message-ID: <62da3059-ee1f-4ec7-a7e3-af5153044d91@redhat.com> (raw)
In-Reply-To: <14e4407c-11b2-42bf-aa63-343762018877@lucifer.local>
On 02.07.25 11:08, Lorenzo Stoakes wrote:
> On Wed, Jul 02, 2025 at 11:00:48AM +0200, David Hildenbrand wrote:
>> On 02.07.25 10:51, Lorenzo Stoakes wrote:
>>> On Wed, Jul 02, 2025 at 10:48:20AM +0200, David Hildenbrand wrote:
>>>> On 02.07.25 10:42, Oscar Salvador wrote:
>>>>> On Fri, Jun 27, 2025 at 01:55:08PM +0200, David Hildenbrand wrote:
>>>>>> Let's clean up a bit:
>>>>>>
>>>>>> (1) No need for start_ptep vs. ptep anymore, we can simply use ptep
>>>>>>
>>>>>> (2) Let's switch to "unsigned int" for everything
>>>>>>
>>>>>> (3) We can simplify the code by leaving the pte unchanged after the
>>>>>> pte_same() check.
>>>>>>
>>>>>> (4) Clarify that we should never exceed a single VMA; it indicates a
>>>>>> problem in the caller.
>>>>>>
>>>>>> No functional change intended.
>>>>>>
>>>>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>>>>
>>>>> Hi David :-),
>>>>>
>>>>> I have to confess that I fell in the same trap as Lorenzo wrt.
>>>>> __pte_batch_clear_ignored changing the pte value.
>>>>> So I'm not sure if it would be nice to place a little comment in
>>>>> __pte_batch_clear_ignored claryfing that pte's value remains unchanged ?
>>>>
>>>> I mean, that's how all our pte modification functions work, really? :)
>>>>
>>>> Thanks!
>>>
>>> I mean, it might be that me and Oscar are similarly 'challenged' in this
>>> respect :P (high 5 Oscar!) but I think the issue here is that it's sort of
>>> a compounded use, and in fact some functions do modify stuff, which is why
>>> we end up with all the ptep ptent etc. fun.
>>>
>>> Up to you re: comment, but I think maybe in cases where it's a reallly
>>> compounded set of stuff it's potentially useful.
>>>
>>> But obviously we still do do this all over the place elsewhere with no
>>> comment...
>>
>> Well, if you are not passing in a *value* and not a pointer to a function,
>> you would not expect for that *value* to change? :)
>>
>> Yes, once we pass pointers it's different. Or when we're using weird macros.
>>
>> Adding a comment that a function will not modify a value that is ...
>> passed-by-value? Maybe it's just me that doesn't get why that should be
>> particularly helpful :)
>
> I think the issue is that we've passed around 'pte' as value and pointer (and of
> course, via macros...) previously so that's the cause of the confusion, often.
>
> This is why I really am a fan of us consistently saying ptep when passing a
> pointer.
100%: pte for pointers is absolutely nasty.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-07-02 9:11 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 11:55 [PATCH v1 0/4] mm: folio_pte_batch() improvements David Hildenbrand
2025-06-27 11:55 ` [PATCH v1 1/4] mm: convert FPB_IGNORE_* into FPB_HONOR_* David Hildenbrand
2025-06-27 13:40 ` Lance Yang
2025-06-27 16:28 ` Lorenzo Stoakes
2025-06-27 16:30 ` David Hildenbrand
2025-06-27 16:33 ` Lorenzo Stoakes
2025-06-29 8:59 ` Mike Rapoport
2025-06-30 13:47 ` David Hildenbrand
2025-06-28 3:37 ` Dev Jain
2025-06-28 21:00 ` David Hildenbrand
2025-06-30 3:34 ` Dev Jain
2025-06-30 9:04 ` Ryan Roberts
2025-06-30 9:08 ` David Hildenbrand
2025-06-30 9:18 ` Ryan Roberts
2025-06-30 9:24 ` David Hildenbrand
2025-06-30 10:57 ` Ryan Roberts
2025-06-30 11:01 ` David Hildenbrand
2025-06-30 14:35 ` Zi Yan
2025-07-02 8:31 ` Oscar Salvador
2025-06-27 11:55 ` [PATCH v1 2/4] mm: smaller folio_pte_batch() improvements David Hildenbrand
2025-06-27 13:58 ` Lance Yang
2025-06-27 16:51 ` Lorenzo Stoakes
2025-06-27 17:02 ` David Hildenbrand
2025-06-27 18:39 ` Lorenzo Stoakes
2025-06-30 17:40 ` Zi Yan
2025-07-02 8:42 ` Oscar Salvador
2025-07-02 8:48 ` David Hildenbrand
2025-07-02 8:51 ` Lorenzo Stoakes
2025-07-02 9:00 ` David Hildenbrand
2025-07-02 9:08 ` Lorenzo Stoakes
2025-07-02 9:11 ` David Hildenbrand [this message]
2025-06-27 11:55 ` [PATCH v1 3/4] mm: split folio_pte_batch() into folio_pte_batch() and folio_pte_batch_ext() David Hildenbrand
2025-06-27 14:19 ` Lance Yang
2025-06-27 15:09 ` David Hildenbrand
2025-06-27 15:45 ` Lance Yang
2025-06-27 18:48 ` Lorenzo Stoakes
2025-06-30 9:19 ` David Hildenbrand
2025-06-30 10:41 ` Lorenzo Stoakes
2025-06-30 10:54 ` David Hildenbrand
2025-06-30 17:45 ` Zi Yan
2025-07-02 9:02 ` Oscar Salvador
2025-07-02 9:05 ` David Hildenbrand
2025-07-02 9:07 ` Oscar Salvador
2025-07-02 9:11 ` David Hildenbrand
2025-07-02 9:09 ` Oscar Salvador
2025-06-27 11:55 ` [PATCH v1 4/4] mm: remove boolean output parameters from folio_pte_batch_ext() David Hildenbrand
2025-06-27 14:34 ` Lance Yang
2025-06-27 15:11 ` David Hildenbrand
2025-06-27 15:40 ` Lance Yang
2025-06-27 19:04 ` Lorenzo Stoakes
2025-06-30 9:32 ` David Hildenbrand
2025-06-30 11:08 ` Lorenzo Stoakes
2025-06-30 11:16 ` David Hildenbrand
2025-06-30 11:18 ` Lorenzo Stoakes
2025-06-30 11:21 ` David Hildenbrand
2025-06-30 17:59 ` Zi Yan
2025-07-02 9:08 ` David Hildenbrand
2025-07-02 9:09 ` 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=62da3059-ee1f-4ec7-a7e3-af5153044d91@redhat.com \
--to=david@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=gourry@gourry.net \
--cc=harry.yoo@oracle.com \
--cc=jannh@google.com \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=matthew.brost@intel.com \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=pfalcato@suse.de \
--cc=rakie.kim@sk.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=ying.huang@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).