summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2013-08-16 21:13:55 +0000
committerjhb <jhb@FreeBSD.org>2013-08-16 21:13:55 +0000
commit3bfcb89de4b7ac6c54e2affe99eccd1482eb4327 (patch)
tree7565121f7abca9570dd1e0d308a2dd838e3c735b /sys/vm/vm_map.h
parentefcf22ed8cf8c3e8d2e5fa37ae4c4a9935a3d597 (diff)
downloadFreeBSD-src-3bfcb89de4b7ac6c54e2affe99eccd1482eb4327.zip
FreeBSD-src-3bfcb89de4b7ac6c54e2affe99eccd1482eb4327.tar.gz
Add new mmap(2) flags to permit applications to request specific virtual
address alignment of mappings. - MAP_ALIGNED(n) requests a mapping aligned on a boundary of (1 << n). Requests for n >= number of bits in a pointer or less than the size of a page fail with EINVAL. This matches the API provided by NetBSD. - MAP_ALIGNED_SUPER is a special case of MAP_ALIGNED. It can be used to optimize the chances of using large pages. By default it will align the mapping on a large page boundary (the system is free to choose any large page size to align to that seems best for the mapping request). However, if the object being mapped is already using large pages, then it will align the virtual mapping to match the existing large pages in the object instead. - Internally, VMFS_ALIGNED_SPACE is now renamed to VMFS_SUPER_SPACE, and VMFS_ALIGNED_SPACE(n) is repurposed for specifying a specific alignment. MAP_ALIGNED(n) maps to using VMFS_ALIGNED_SPACE(n), while MAP_ALIGNED_SUPER maps to VMFS_SUPER_SPACE. - mmap() of a device object now uses VMFS_OPTIMAL_SPACE rather than explicitly using VMFS_SUPER_SPACE. All device objects are forced to use a specific color on creation, so VMFS_OPTIMAL_SPACE is effectively equivalent. Reviewed by: alc MFC after: 1 month
Diffstat (limited to 'sys/vm/vm_map.h')
-rw-r--r--sys/vm/vm_map.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
index ed8864e..054c506 100644
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -339,12 +339,16 @@ long vmspace_resident_count(struct vmspace *vmspace);
#define VM_FAULT_READ_AHEAD_MAX min(atop(MAXPHYS) - 1, UINT8_MAX)
/*
- * The following "find_space" options are supported by vm_map_find()
+ * The following "find_space" options are supported by vm_map_find().
+ *
+ * For VMFS_ALIGNED_SPACE, the desired alignment is specified to
+ * the macro argument as log base 2 of the desired alignment.
*/
#define VMFS_NO_SPACE 0 /* don't find; use the given range */
#define VMFS_ANY_SPACE 1 /* find a range with any alignment */
#define VMFS_OPTIMAL_SPACE 2 /* find a range with optimal alignment*/
-#define VMFS_ALIGNED_SPACE 3 /* find a superpage-aligned range */
+#define VMFS_SUPER_SPACE 3 /* find a superpage-aligned range */
+#define VMFS_ALIGNED_SPACE(x) ((x) << 8) /* find a range with fixed alignment */
/*
* vm_map_wire and vm_map_unwire option flags
OpenPOWER on IntegriCloud