MS_ASYNC with MS_INVALIDATE

Dan Nelson dnelson at allantgroup.com
Sun Mar 28 13:02:37 PST 2004


In the last episode (Mar 27), Mark Terribile said:
> A friend asked me to run some Linux source on FreeBSD.  It simulates
> a data pool management system he is using, and it includes a call
> msync(2) with both the MS_ASYNC and MS_INVALIDATE flags.  FreeBSD
> does not allow this. (I tested it on my 4.8 system; I'll have access
> to a 5.1 system on Monday.) I ran it without the MS_ASYNC, and got
> very different results from the ones he reported on Linux.  I'd like
> to be able to explain what's happening.
> 
> Would someone please shed some light on why this combination of flags
> is disallowed, and what the intended semantics are?  I suspect that
> either I or he has a subtle misunderstanding here.

Does that even make sense?  How could you simultaneously request that
all modified pages be queued for writing to disk AND that all modified
pages be discarded?  If you discard them, then there's nothing for the
kernel to write.  This has been an invalid request as long as FreeBSD
has supported msync flags:

revision 1.20
date: 1995/03/25 17:36:00;  author: davidg;  state: Exp;  lines: +6 -3
Disallow both MS_ASYNC and MS_INVALIDATE flags being set at the same time
in msync().
----------------------------
revision 1.19
date: 1995/03/25 16:55:46;  author: davidg;  state: Exp;  lines: +11 -14
Added "flags" argument to msync, and implemented MS_ASYNC and MS_INVALIDATE.
The MS_ASYNC flag doesn't current work, and MS_INVALIDATE will only toss out
the pages in the address space (not all pages in the shadow chain).

I don't know if MS_ASYNC currently works; alc would be the person to
ask about it, since it looks like he worked on msync and vm_map_sync in
November.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-hackers mailing list