Re: [PATCH v1 07/11] mm/sparse-vmemmap: populate compound pagemaps

Joao Martins
2021-05-13T18:46:45Z

On 5/10/21 8:19 PM, Dan Williams wrote:
> On Thu, May 6, 2021 at 4:02 AM Joao Martins <joao.m.martins@oracle.com> wrote:
> [..]
>>>> +static pte_t * __meminit vmemmap_lookup_address(unsigned long addr)
>>>
>>> I think this can be replaced with a call to follow_pte(&init_mm...).
>>>
>>
>> Ah, of course! That would shorten things up too.
>
> Now that I look closely, I notice that function disclaims being
> suitable as a general purpose pte lookup utility.
> If it works for you,
> great, but if not I think it's past time to create such a helper. I
> know Ira is looking for one, and I contributed to the proliferation
> when I added dev_pagemap_mapping_shift().
>
There's also x86 equivalents, like lookup_address() and lookup_address_in_pgd().
These two don't differ that much from vmemmap_lookup_address().

I can move this to an internal place e.g. mm/internal.h

The patch after this one, changes vmemmap_lookup_address() to stop at the PMD (to reuse
that across the next sections).