Re: PATCH: Raw device IO for 2.1.131

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Tue, 15 Dec 1998 01:02:16 +0000


On Mon, Dec 14, 1998 at 05:23:43PM +0100, Matthias Urlichs wrote:
> Note that if you have a page-aligned buffer and do a page-aligned read, the
> kernel is / should be (don't ask me...) clever enough to toss your existing
> page entirely and to map the appropriate page from the file into your space
> (copy-on-write, of course). That gives you a zero-copy read, at least.

I was thinking of implementing this a few years ago. We hashed it out
on the list, and the hand-waving consensus was that copying a single
page is faster than changing the MMU entry, and the complex IPI-based
TLB invalidation sequence that follows on SMP as very bad. On UP, the
TLB invalidation is less critical but it is still quite complex to do
the page diddling and not necessarily a win.

An additional complication is it means there's yet another way of
sharing user pages with the page cache, that's separate from the mmap()
way (and has different semantics).

That said, working out _when_ it's safe to share a page with it should
not be _that_ complex, and if the PageAccessed() bit is not set,
presumably there's no need to invalidate the TLB across processors.

> In fact, the stdio implementation in glibc was explicitly changed to
> support this.

Nice planning.
I might give it another look if someone do so first.
That'll be _well_ into 2.3 though.

-- Jamie

-
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/