PERFORCE change 200255 for review
John Baldwin
jhb at FreeBSD.org
Sat Oct 15 21:46:46 UTC 2011
http://p4web.freebsd.org/@@200255?ac=10
Change 200255 by jhb at jhb_fiver on 2011/10/15 21:46:16
Change FADV_DONTNEED to actually force the pages out similar
to msync(MS_INVALIDATE) by calling vm_object_sync().
I want to change FADV_WILLNEED to actually kick off a read-ahead
if needed, but not sure how best to do that.
Affected files ...
.. //depot/projects/fadvise/sys/kern/vfs_syscalls.c#6 edit
Differences ...
==== //depot/projects/fadvise/sys/kern/vfs_syscalls.c#6 (text+ko) ====
@@ -4941,11 +4941,8 @@
mtx_pool_unlock(mtxpool_sleep, fp);
break;
case FADV_WILLNEED:
- case FADV_DONTNEED:
/*
- * Apply the request to the backing VM object. Note
- * that the FADV_* constants map directly to the same
- * madvise(2) constants.
+ * Apply the request to the backing VM object.
*
* XXX: madvise(MADV_WILLNEED) will not do readahead on
* a file, perhaps FADV_WILLNEED should.
@@ -4956,10 +4953,19 @@
vn_lock(vp, LK_SHARED | LK_RETRY);
if (vp->v_object != NULL)
vm_object_madvise(vp->v_object, OFF_TO_IDX(start),
- atop(end - start), uap->advice);
+ atop(end - start), MADV_WILLNEED);
VOP_UNLOCK(vp, 0);
VFS_UNLOCK_GIANT(vfslocked);
break;
+ case FADV_DONTNEED:
+ /*
+ * Invalidate pages from the backing VM object similar
+ * to msync(MS_INVALIDATE).
+ */
+ if (vp->v_object != NULL)
+ vm_object_sync(vp->v_object, uap->offset, end - uap->offset,
+ FALSE, TRUE);
+ break;
}
out:
fdrop(fp, td);
More information about the p4-projects
mailing list