linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
	linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@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 1/4] mm: convert FPB_IGNORE_* into FPB_HONOR_*
Date: Mon, 30 Jun 2025 11:24:08 +0200	[thread overview]
Message-ID: <8993dbc9-6c9a-4ac7-8c04-813851eba938@redhat.com> (raw)
In-Reply-To: <79525362-2377-441b-8575-d2307bd77f26@arm.com>

On 30.06.25 11:18, Ryan Roberts wrote:
> On 30/06/2025 10:08, David Hildenbrand wrote:
>> On 30.06.25 11:04, Ryan Roberts wrote:
>>> On 30/06/2025 04:34, Dev Jain wrote:
>>>>
>>>> On 29/06/25 2:30 am, David Hildenbrand wrote:
>>>>> On 28.06.25 05:37, Dev Jain wrote:
>>>>>>
>>>>>> On 27/06/25 5:25 pm, David Hildenbrand wrote:
>>>>>>> Honoring these PTE bits is the exception, so let's invert the meaning.
>>>>>>>
>>>>>>> With this change, most callers don't have to pass any flags.
>>>>>>>
>>>>>>> No functional change intended.
>>>>>>
>>>>>> FWIW I had proposed this kind of change earlier to Ryan (CCed) and
>>>>>> he pointed out: "Doesn't that argument apply in reverse if you want
>>>>>> to ignore something new in future?
>>>>>>
>>>>>> By default we are comparing all the bits in the pte when determining the
>>>>>> batch.
>>>>>> The flags request to ignore certain bits.
>>>>>
>>>>> That statement is not true: as default we ignore the write and young bit. And
>>>>> we don't have flags for that ;)
>>>>>
>>>>> Now we also ignore the dirty and soft-dity bit as default, unless told not to
>>>>> do that by one very specific caller.
>>>>>
>>>>>> If we want to ignore extra bits in
>>>>>> future, we add new flags and the existing callers don't need to be updated.
>>>>>
>>>>> What stops you from using FPB_IGNORE_* for something else in the future?
>>>>>
>>>>> As a side note, there are not that many relevant PTE bits to worry about in
>>>>> the near future ;)
>>>>>
>>>>> I mean, uffd-wp, sure, ... and before we add a FPB_HONOR_UFFD_WP to all users
>>>>> to be safe (and changing the default to ignore), you could add a
>>>>> FPB_IGNORE_UFFD_WP first, to then check who really can tolerate just ignoring
>>>>> it (most of them, I assume).
>>>> I agree.
>>>
>>> Meh. Personally I think if you start mixing HONOR and IGNORE flags, it becomes
>>> very confusing to work out what is being checked for and what is not. I stand by
>>> my original view. But yeah, writable and young confuse it a bit... How about
>>> generalizing by explicitly requiring IGNORE flags for write and young, then also
>>> create a flags macro for the common case?
>>>
>>> #define FPB_IGNORE_COMMON (FPB_IGNORE_WRITE | FPB_IGNORE_YOUNG |    \
>>>                 FPB_IGNORE_DIRTY | FPB_IGNORE_SOFT_DIRTY)
>>>
>>> It's not a hill I'm going to die on though...
>>
>> How about we make this function simpler, not more complicated? ;)
> 
> I think here we both have different views of what is simpler... You are trying
> to optimize for the callers writing less code. I'm trying to optimize for the
> reader to be able to easily determine what the function will do for a given caller.

See patch number #3: I want the default function -- folio_pte_batch() -- 
to not have any flags at all.

And I don't want to achieve that by internally using flags when calling 
folio_pte_batch_ext().

If you don't specify flags (folio_pte_batch()), behave just as if 
calling folio_pte_batch_ext() without flags. Anything else would be more 
confusing IMHO.

I agree that mixing HONOR and IGNORE is not a good idea. But then, it's 
really only uffd-wp that still could be batched, and likely we want it 
to be the default, and respect/honor/whatever instead in the cases where 
we really have to.

(If we really want to go down that path and batch it :) )

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-06-30  9:24 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 [this message]
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
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=8993dbc9-6c9a-4ac7-8c04-813851eba938@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=dev.jain@arm.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=pfalcato@suse.de \
    --cc=rakie.kim@sk.com \
    --cc=riel@surriel.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --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