[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3230697b-55ea-4776-a5f8-5116366741ad@redhat.com>
Date: Wed, 7 Aug 2024 11:31:55 +0200
From: David Hildenbrand <david@...hat.com>
To: Claudio Imbrenda <imbrenda@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-doc@...r.kernel.org, kvm@...r.kernel.org, linux-s390@...r.kernel.org,
linux-fsdevel@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Jonathan Corbet <corbet@....net>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>, Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>, Alexander Gordeev
<agordeev@...ux.ibm.com>, Sven Schnelle <svens@...ux.ibm.com>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>
Subject: Re: [PATCH v1 02/11] mm/pagewalk: introduce folio_walk_start() +
folio_walk_end()
On 07.08.24 11:17, Claudio Imbrenda wrote:
> On Fri, 2 Aug 2024 17:55:15 +0200
> David Hildenbrand <david@...hat.com> wrote:
>
>> We want to get rid of follow_page(), and have a more reasonable way to
>> just lookup a folio mapped at a certain address, perform some checks while
>> still under PTL, and then only conditionally grab a folio reference if
>> really required.
>>
>> Further, we might want to get rid of some walk_page_range*() users that
>> really only want to temporarily lookup a single folio at a single address.
>>
>> So let's add a new page table walker that does exactly that, similarly
>> to GUP also being able to walk hugetlb VMAs.
>>
>> Add folio_walk_end() as a macro for now: the compiler is not easy to
>> please with the pte_unmap()->kunmap_local().
>>
>> Note that one difference between follow_page() and get_user_pages(1) is
>> that follow_page() will not trigger faults to get something mapped. So
>> folio_walk is at least currently not a replacement for get_user_pages(1),
>> but could likely be extended/reused to achieve something similar in the
>> future.
>
[...]
>> +pmd_table:
>> + VM_WARN_ON_ONCE(pud_leaf(*pudp));
>
Thanks for the review!
> is this warning necessary? can this actually happen?
> and if it can happen, wouldn't it be more reasonable to return NULL?
The we have to turn this into an unconditional WARN_ON_ONCE() that
cannot be compiled out.
It's something that should be found early during testing (like I had a
bug where I misspelled "CONFIG_PGTABLE_HAS_HUGE_LEAVES" above that took
me 2h to debug, so I added it ;) ), and shouldn't need runtime checks.
Same for the other one.
Thanks!
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists