Re: mmap() versus read()

Larry McVoy (lm@who.net)
Mon, 09 Mar 1998 11:08:27 -0800


: > The real problem is this: can a process put a request in the disk
: > queue and then return from system all, leaving the OS to finish it up?
:
: It could if we use a kernel thread to do the actual paging...

It is possible that you'll want a thread to handle the case that the
inode is locked so you can't add pages to it. It would be better if
those locks were fast, i.e., held only for a few instructions so that
you could spin and grab it.

In general, however, you don't want to involve threads unless you have to.
If the OS can do read ahead without a kernel thread, it can do prefetch
on any arbitrary object without a thread.

Threads cost a stack, at minimum. You certainly don't want a thread per
prefetch, right? That would be counterproductive (ask me about Solaris
sometime). So you're going to have to have a mechanism that works without
process context, i.e., from the interrupt completion routine. If you
allocate any memory needed as part of the initiation, so when you are in
the interrupt you already have everything you need to enter it into the
page cache, then you are pretty much all set.

--lm

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