Re: 1352 NUL bytes at the end of a page?

From: Larry McVoy
Date: Mon May 17 2004 - 10:31:44 EST


On Mon, May 17, 2004 at 08:22:10AM -0700, Linus Torvalds wrote:
> On Mon, 17 May 2004, Theodore Ts'o wrote:
> > Note though that the stdio library uses a writeable mmap to implement
> > fwrite.
>
> It does? Whee. Then I'll have to agree with Andrew - if there is a path
> that is more likely to have bugs, it's trying to do writes with mmap and
> ftruncate.
>
> Who came up with that braindead idea? Is it some crazed Mach developer
> that infiltrated the glibc development group?

You have my agreement on the craziness of this idea. It's a lot easier for
the kernel to do smart things with write behind with write() rather than
mmap()-ed pages being touched. SunOS is the only system I know which does
both "correctly" (correctly meaning the same way whether it is mmap or
write).

It's also a lose to do mmap() instead of read/write for small files. Linux
is light weight enough that the cross over point is pretty small, probably
under 8K and certainly under 16K, but still.
--
---
Larry McVoy lm at bitmover.com http://www.bitkeeper.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/