summaryrefslogtreecommitdiffstats
path: root/include/sys/vmsystm.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-02-04 15:15:41 -0800
committerBrian Behlendorf <[email protected]>2009-02-04 15:15:41 -0800
commit36b313dacf2f60f526fe98b7e9d1a6bbcbb250d2 (patch)
treef6441a23afb2eebbe2490dae46abd5aad8beede7 /include/sys/vmsystm.h
parent31a033ecd49c2f691d6a377db2882ed941f47481 (diff)
Linux VM integration / device special files
Support added to provide reasonable values for the global Solaris VM variables: minfree, desfree, lotsfree, needfree. These values are set to the sum of their per-zone linux counterparts which should be close enough for Solaris consumers. When a non-GPL app links against the SPL we cannot use the udev interfaces, which means non of the device special files are created. Because of this I had added a poor mans udev which cause the SPL to invoke an upcall and create the basic devices when a minor is registered. When a minor is unregistered we use the vnode interface to unlink the special file.
Diffstat (limited to 'include/sys/vmsystm.h')
-rw-r--r--include/sys/vmsystm.h62
1 files changed, 36 insertions, 26 deletions
diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h
index 1cb716f13..a6e9e7d7e 100644
--- a/include/sys/vmsystm.h
+++ b/include/sys/vmsystm.h
@@ -27,19 +27,50 @@
#ifndef _SPL_VMSYSTM_H
#define _SPL_VMSYSTM_H
+#include <linux/mmzone.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <sys/types.h>
#include <asm/uaccess.h>
-extern vmem_t *zio_alloc_arena; /* arena for zio caches */
+/* These values are loosely coupled with the the VM page reclaim.
+ * Linux uses its own heuristics to trigger page reclamation, and
+ * because those interface are difficult to interface with. These
+ * values should only be considered as a rough guide to the system
+ * memory state and not as direct evidence that page reclaimation
+ * is or is not currently in progress.
+ */
+#define ptob(pages) (pages * PAGE_SIZE)
+#define membar_producer() smp_wmb()
#define physmem num_physpages
#define freemem nr_free_pages()
-#define minfree 0
-#define needfree 0 /* # of needed pages */
-#define ptob(pages) (pages * PAGE_SIZE)
-#define membar_producer() smp_wmb()
+
+extern pgcnt_t minfree; /* Sum of zone->pages_min */
+extern pgcnt_t desfree; /* Sum of zone->pages_low */
+extern pgcnt_t lotsfree; /* Sum of zone->pages_high */
+extern pgcnt_t needfree; /* Always 0 */
+extern pgcnt_t swapfs_minfree;
+extern pgcnt_t swapfs_desfree;
+extern pgcnt_t swapfs_reserve;
+extern pgcnt_t availrmem;
+
+extern vmem_t *heap_arena; /* primary kernel heap arena */
+extern vmem_t *zio_alloc_arena; /* arena for zio caches */
+extern vmem_t *zio_arena; /* arena for allocating zio memory */
+
+#define VMEM_ALLOC 0x01
+#define VMEM_FREE 0x02
+
+static __inline__ size_t
+vmem_size(vmem_t *vmp, int typemask)
+{
+ /* Arena's unsupported */
+ ASSERT(vmp == NULL);
+ ASSERT(typemask & (VMEM_ALLOC | VMEM_FREE));
+
+ return 0;
+}
#define xcopyin(from, to, size) copy_from_user(to, from, size)
#define xcopyout(from, to, size) copy_to_user(to, from, size)
@@ -82,25 +113,4 @@ copyinstr(const void *from, void *to, size_t len, size_t *done)
return 0;
}
-#if 0
-/* The average number of free pages over the last 5 seconds */
-#define avefree 0
-
-/* The average number of free pages over the last 30 seconds */
-#define avefree30 0
-
-/* A guess as to how much memory has been promised to
- * processes but not yet allocated */
-#define deficit 0
-
-/* A bootlean the controls the setting of deficit */
-#define desperate
-
-/* When free memory is above this limit, no paging or swapping is done */
-#define lotsfree 0
-
-/* When free memory is above this limit, swapping is not performed */
-#define desfree 0
-#endif
-
#endif /* SPL_VMSYSTM_H */