Re: mapping user space buffer to kernel address space

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Thu Oct 19 2000 - 17:50:22 EST


Andrea Arcangeli wrote:
>
> On Thu, Oct 19, 2000 at 05:16:14PM -0400, Jeff Garzik wrote:
> > solution is really elegant. Excluding all the debug code and assertions
> > I stick in there, the guts of via audio mmap support went from ~50 lines
> > to ~10.
>
> Was it 50 lines with remap_page_range?

Yeah. Via audio is scatter-gather, so I had a function via_mmap_chan
which had to walk the scatter-gather list, calling remap_page_range for
each PAGE_SIZE'd dma buffer.

Now with nopage(), the need to walk the scatter-gather list is
completely avoided. The scatter-gather info is stored as an array, so
finding the physical address for a virtual page is a direct lookup.

> Which is the advantage of introducing pagefaults that we can avoid? (and
> that we are also used to avoid)

Well, I don't know the VM well so I can't say how bad the lack of
VM_LOCK will affect latency, if at all.

I prefer this way because it seems the most clean -- let the system
pagefault if it wants to, we're not really losing the buffer, only a
reference to it.

        Jeff

-- 
Jeff Garzik                    | The difference between laziness and
Building 1024                  | prioritization is the end result.
MandrakeSoft                   |
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:16 EST