Re: mmap() better than read() fro streaming, Was: Re: Streaming disk I/O kills file buffering and ma

Alan Cox (alan@lxorguk.ukuu.org.uk)
Wed, 25 Aug 1999 15:21:08 +0100 (BST)


> As you suggested I do basically the following:
> - ptr=mmap() at current offset with len=512k
> - memcpy(targetbuffer,ptr,len) (I must use the memcpy since targetbuffer has
> to be mlocked() since the audio-playing thread can't tolerate pagefaults
> because it runs in a low-latency cycle.
> - munmap(ptr,len)

You can do
ptr=mmap(blah)
mlock(ptr, ...)
munmap(ptr, len)

> Does anyone know if there it/will be a way to do unbuffered mmap() ?
> I think streaming apps would benefit quite a bit from this.

mmap requires buffering - you are sharing the page with the system page
cache. If you mean you want an mgoaway() to go with munmap() thats what
madvise() provides on some other systems but not Linux yet

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/