Re: linux-kernel-digest V1 #2139

Jeffrey B. Siegal (jbs@quiotix.com)
Thu, 25 Jun 1998 16:46:10 -0700


> From: lm@bitmover.com (Larry McVoy)
> Date: Thu, 25 Jun 1998 10:05:17 -0700
> Subject: Re: Thread implementations...
>
> : caddr_t buf = mmap(0, len, PROT_READ, MAP_FILE | MAP_SHARED, ifd, 0);
> : write(ofd, buf, len);
>
> 1) Your model above still does a copy. So the cold cache numbers can
> never be faster than 1/4 of memory speed: DMA in, copy, DMA out.
> The best numbers are 1/2 memory speed: DMA in, DMA out.

I don't see a copy being necessary, although a simplistic implementation would perform one.

> 2) On SGI's, for server type of operations, the mmap() is the bottleneck.
> You are setting up and tearing down a virtual mapping that you don't
> need

This could be avoided by making mmap "lazy." Mmap would return a pointer to a known unmapped area of address space. The
virtual mapping wouldn't be set up until an actual page fault occurred. Write would recognize the buffer as being one of
these "deferred mmap areas" and do the direct fd -> fd copy rather than setting up the page table entries.

Ultimately though, this still requires an extra system call (mmap + write rather than just copyfile) so it probably still
wouldn't be quite as good as a new "copyfile" system call. An advantage, though, is that some programs will get the benefit
of the optimization without being modified to use a new system call.

By the way, there are applications for this where the input would not be a real file. For example, video capture, or a file
server when doing writes (most file server I/Os are writes).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu