summaryrefslogtreecommitdiffstats
path: root/sys/sys/mman.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/sys/mman.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/sys/mman.h')
-rw-r--r--sys/sys/mman.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/sys/mman.h b/sys/sys/mman.h
index a178d7c..c5e47a0 100644
--- a/sys/sys/mman.h
+++ b/sys/sys/mman.h
@@ -91,6 +91,17 @@
*/
#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
#define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */
+
+/*
+ * Request specific alignment (n == log2 of the desired alignment).
+ *
+ * MAP_ALIGNED_SUPER requests optimal superpage alignment, but does
+ * not enforce a specific alignment.
+ */
+#define MAP_ALIGNED(n) ((n) << MAP_ALIGNMENT_SHIFT)
+#define MAP_ALIGNMENT_SHIFT 24
+#define MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff)
+#define MAP_ALIGNED_SUPER MAP_ALIGNED(1) /* align on a superpage */
#endif /* __BSD_VISIBLE */
#if __POSIX_VISIBLE >= 199309
OpenPOWER on IntegriCloud