Re: msync() behaviour broken for MS_ASYNC, revert patch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-02-10 at 15:15 -0800, Linus Torvalds wrote:

> > IIRC msync(MS_INVALIDATE) on Solaris was actually often used by some
> > applications to resync the client page cache to the server when using
> > odd locking schemes, so I believe this interpretation is a valid one.
> 
> I think you're right. Although I would also guess that 99% of the time, 
> you'd only do that for read-only mappings. Doing the same in the presense 
> of also doing writes is just asking for getting shot.
> 
> Even for read-only mappings, it's actually quite hard to globally flush a 
> page cache page if somebody else happens to be using it for a read() or 
> something at exactly the same time.

I'm thinking specifically of the case where the application is using
some fancy user space locking scheme of its own to guarantee safe read
access to a part of the file that is known to have changed on the
server.

We do have fadvise(POSIX_FADV_DONTNEED), which gets you most of the way.
However that calls invalidate_mapping_pages(), which only clears
unlocked pages. This again means that kernel activities like readahead
or VM scanning can cause pages the user would otherwise like to eject to
be preserved.

The other alternative is to use O_DIRECT file access, but that forces
the application to handle caching and readahead in user space too.

Cheers,
  Trond

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux