Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings

Nicholas Piggin
2020-07-20T02:49:14Z

Excerpts from Zefan Li's message of July 20, 2020 12:02 pm:
>> +static int vmap_pages_range_noflush(unsigned long start, unsigned long end,
>> + pgprot_t prot, struct page **pages,
>> + unsigned int page_shift)
>> +{
>> + if (page_shift == PAGE_SIZE) {
>
> Is this a typo of PAGE_SHIFT?

Oh good catch, yeah that'll always be going via the one-at-a-time route
and slow down the small page vmaps. Will fix.

Thanks,
Nick

>
>> + return vmap_small_pages_range_noflush(start, end, prot, pages);
>> + } else {
>> + unsigned long addr = start;
>> + unsigned int i, nr = (end - start) >> page_shift;
>> +
>> + for (i = 0; i < nr; i++) {
>> + int err;
>> +
>> + err = vmap_range_noflush(addr,
>> + addr + (1UL << page_shift),
>> + __pa(page_address(pages[i])), prot,
>> + page_shift);
>> + if (err)
>> + return err;
>> +
>> + addr += 1UL << page_shift;
>> + }
>> +
>> + return 0;
>> + }
>> +}
>> +
>