Re: [Intel-gfx] [PATCH 3/6] drm/i915: use vmap in shmem_pin_map

From: Christoph Hellwig
Date: Tue Sep 22 2020 - 10:31:47 EST

On Tue, Sep 22, 2020 at 09:23:59AM +0100, Tvrtko Ursulin wrote:
> If I understood this sub-thread correctly, iterating and freeing the pages
> via the vmapped ptes, so no need for a
> shmem_read_mapping_page_gfp loop in shmem_unpin_map looks plausible to me.
> I did not get the reference to kernel/dma/remap.c though,

What I mean is the code in dma_common_find_pages, which returns the
page array for freeing.

> and also not sure
> how to do the error unwind path in shmem_pin_map at which point the
> allocated vm area hasn't been fully populated yet. Hand-roll the loop
> walking vm area struct in there?

Yes. What I originally did (re-created as I didn't save it) would be
something like this: