Re: [PATCH] mm/vmalloc: fix mischeck pfn valid in vmap_pfns

From: Gao Xiang
Date: Wed Mar 19 2025 - 05:09:25 EST




On 2025/3/18 16:44, Christoph Hellwig wrote:
On Tue, Mar 18, 2025 at 04:39:40PM +0800, Huan Yang wrote:
A folio may be 2MB or more large 1GB, what if we only need a little, 1M or 512MB, can vmap based on folio can solve it?

Then you only map part of it by passing a length argument. Note that
in general when you have these large folios you also don't have highmem,
so if you only map one of them, or part of one of them you don't actually
need vmap at all and can just use folio-address..

Normally, can offer 4k-page based array map it. But consider HVO, can't. That's why wanto base on pfn.

Well, for any large folio using this 4k based page interface is
actually highly inefficient. So let's fix that. And my loop in
willy as Mr. Folio while you're at it.

The minimum map unit is page size instead of variable-size folio.

For many cases, vmap (to combine many partial folios) is useful
(instead of split all folios to order-0 folios in advance) but
I agree page array may be inefficient.

So I don't think another folio vmap() version is better overall
anyway.

Thanks,
Gao Xiang