Re: write(2) and page cache

From: Hugh Dickins
Date: Tue Jul 30 2013 - 01:54:29 EST

On Sun, 28 Jul 2013, dmi p wrote:
> Hi,
> When I write(2) on a file such that the size of the buffer being
> written is less than the page size, and the page is not in the page
> cache, does the write syscall block until the page is brought into the
> page cache from disk (to modify it and eventually write back),

Yes (except perhaps when overwriting that part of page at end of file:
I expect some filesystems might optimize out that read, and others not).

> or is the page reading part async with respect to write?

No, that would involve another layer of buffering, which I think
would be too hard to synchronize with page cache and mmap.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at