summaryrefslogtreecommitdiffstats
path: root/include/sys/vmsystm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys/vmsystm.h')
-rw-r--r--include/sys/vmsystm.h65
1 files changed, 62 insertions, 3 deletions
diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h
index 75ae8a991..7876fc72b 100644
--- a/include/sys/vmsystm.h
+++ b/include/sys/vmsystm.h
@@ -58,12 +58,71 @@ 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
-
extern pgcnt_t spl_kmem_availrmem(void);
extern size_t vmem_size(vmem_t *vmp, int typemask);
+/*
+ * The following symbols are available for use within the kernel
+ * itself, and they used to be available in older kernels. But it
+ * looks like they have been removed perhaps due to lack of use.
+ * For our purposes we need them to access the global memory state
+ * of the system, which is even available to user space process
+ * in /proc/meminfo. It's odd to me that there is no kernel API
+ * to get the same information, minimally the proc handler for
+ * the above mentioned /proc/meminfo file would make use of it.
+ */
+
+/* Source linux/fs/proc/mmu.c */
+#ifndef HAVE_GET_VMALLOC_INFO
+#ifdef CONFIG_MMU
+
+struct vmalloc_info {
+ unsigned long used;
+ unsigned long largest_chunk;
+};
+
+typedef void (*get_vmalloc_info_t)(struct vmalloc_info *);
+extern get_vmalloc_info_t get_vmalloc_info_fn;
+
+# define VMEM_ALLOC 0x01
+# define VMEM_FREE 0x02
+# define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
+# define get_vmalloc_info(vmi) get_vmalloc_info_fn(vmi)
+#else
+# error "CONFIG_MMU must be defined"
+#endif /* CONFIG_MMU */
+#endif /* HAVE_GET_VMALLOC_INFO */
+
+/* Source linux/mm/mmzone.c */
+#ifndef HAVE_FIRST_ONLINE_PGDAT
+typedef struct pglist_data *(*first_online_pgdat_t)(void);
+extern first_online_pgdat_t first_online_pgdat_fn;
+#define first_online_pgdat() first_online_pgdat_fn()
+#endif /* HAVE_FIRST_ONLINE_PGDAT */
+
+/* Source linux/mm/mmzone.c */
+#ifndef HAVE_NEXT_ONLINE_PGDAT
+typedef struct pglist_data *(*next_online_pgdat_t)(struct pglist_data *);
+extern next_online_pgdat_t next_online_pgdat_fn;
+#define next_online_pgdat(pgd) next_online_pgdat_fn(pgd)
+#endif /* HAVE_NEXT_ONLINE_PGDAT */
+
+/* Source linux/mm/mmzone.c */
+#ifndef HAVE_NEXT_ZONE
+typedef struct zone *(*next_zone_t)(struct zone *);
+extern next_zone_t next_zone_fn;
+#define next_zone(zone) next_zone_fn(zone)
+#endif /* HAVE_NEXT_ZONE */
+
+/* Source linux/mm/vmstat.c */
+#ifndef HAVE_GET_ZONE_COUNTS
+typedef void (*get_zone_counts_t)(unsigned long *, unsigned long *,
+ unsigned long *);
+extern get_zone_counts_t get_zone_counts_fn;
+#define get_zone_counts(a,i,f) get_zone_counts_fn(a,i,f)
+#endif /* HAVE_GET_ZONE_COUNTS */
+
+
#define xcopyin(from, to, size) copy_from_user(to, from, size)
#define xcopyout(from, to, size) copy_to_user(to, from, size)