aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_object.h
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2016-12-08 11:26:11 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2016-12-08 11:26:11 +0000
commitc42b43a0545eb23e7d771ecc004dd18e31367433 (patch)
treed127721d72e9a9fc663c2a1a0c3cc2acdbb5fae5 /sys/vm/vm_object.h
parentdc5401d24086046f10ac68b0648e2c136333730f (diff)
downloadsrc-c42b43a0545eb23e7d771ecc004dd18e31367433.tar.gz
src-c42b43a0545eb23e7d771ecc004dd18e31367433.zip
Add a new populate() pager method and extend device pager ops vector
with cdev_pg_populate() to provide device drivers access to it. It gives drivers fine control of the pages ownership and allows drivers to implement arbitrary prefault policies. The populate method is called on a page fault and is supposed to populate the vm object with the page at the fault location and some amount of pages around it, at pager's discretion. VM provides the pager with the hints about current range of the object mapping, to avoid instantiation of immediately unused pages, if pager decides so. Also, VM passes the fault type and map entry protection to the pager, allowing it to force the optimal required ownership of the mapped pages. Installed pages must contiguously fill the returned region, be fully valid and exclusively busied. Of course, the pages must be compatible with the object' type. After populate() successfully returned, VM fault handler installs as many instantiated pages into the process page tables as it sees reasonable, while still obeying the correct semantic for COW and vm map locking. The method is opt-in, pager sets OBJ_POPULATE flag to indicate that the method can be called. If pager' vm objects can be shadowed, pager must implement the traditional getpages() method in addition to the populate(). Populate() might fall back to the getpages() on per-call basis as well, by returning VM_PAGER_BAD error code. For now for device pagers, the populate() method is only allowed to be used by the managed device pagers, but the limitation is only made because there is no unmanaged fault handlers which could use it right now. KPI designed together with, and reviewed by: alc Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=309710
Diffstat (limited to 'sys/vm/vm_object.h')
-rw-r--r--sys/vm/vm_object.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index 52bc44ce2b3b..ae450e09719d 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -181,6 +181,7 @@ struct vm_object {
*/
#define OBJ_FICTITIOUS 0x0001 /* (c) contains fictitious pages */
#define OBJ_UNMANAGED 0x0002 /* (c) contains unmanaged pages */
+#define OBJ_POPULATE 0x0004 /* pager implements populate() */
#define OBJ_DEAD 0x0008 /* dead objects (during rundown) */
#define OBJ_NOSPLIT 0x0010 /* dont split this object */
#define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */