summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-11-09 22:09:04 +0000
committeralc <alc@FreeBSD.org>2003-11-09 22:09:04 +0000
commitb2bc11d840b269eb5927723a806087bb3444d082 (patch)
treee01c4379016581f313959e38c98f7afddfeecae1 /sys/vm/vm_map.c
parentb5775784dd2b0165b4cd9c025e3d8ff6cb67b0e4 (diff)
downloadFreeBSD-src-b2bc11d840b269eb5927723a806087bb3444d082.zip
FreeBSD-src-b2bc11d840b269eb5927723a806087bb3444d082.tar.gz
- Remove Giant from msync(2). Giant is still acquired by the lower layers
if we drop into the pmap or vnode layers. - Migrate the handling of zero-length msync(2)s into vm_map_sync() so that multithread applications can't change the map between implementing the zero-length hack in msync(2) and reacquiring the map lock in vm_map_sync(). Reviewed by: tegge
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 40db4c1..0fb7fc1 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -1952,6 +1952,13 @@ done:
* If syncio is TRUE, dirty pages are written synchronously.
* If invalidate is TRUE, any cached pages are freed as well.
*
+ * If the size of the region from start to end is zero, we are
+ * supposed to flush all modified pages within the region containing
+ * start. Unfortunately, a region can be split or coalesced with
+ * neighboring regions, making it difficult to determine what the
+ * original region was. Therefore, we approximate this requirement by
+ * flushing the current region containing start.
+ *
* Returns an error if any part of the specified range is not mapped.
*/
int
@@ -1973,6 +1980,9 @@ vm_map_sync(
if (!vm_map_lookup_entry(map, start, &entry)) {
vm_map_unlock_read(map);
return (KERN_INVALID_ADDRESS);
+ } else if (start == end) {
+ start = entry->start;
+ end = entry->end;
}
/*
* Make a first pass to check for holes.
OpenPOWER on IntegriCloud