summaryrefslogtreecommitdiffstats
path: root/include/sys/vmsystm.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-07-28 15:06:42 -0700
committerBrian Behlendorf <[email protected]>2009-07-28 15:06:42 -0700
commit6ae7fef5b94275e50cc1dcd48c4ecf3b70d7f9d9 (patch)
tree6bee188c48e16981416bab356d02bc02817edae0 /include/sys/vmsystm.h
parent6b09f739398a644384bfbab87792e4681707aef1 (diff)
Update global_page_state() support for 2.6.29 kernels.
Basically everything we need to monitor the global memory state of the system is now cleanly available via global_page_state(). The problem is that this interface is still fairly recent, and there has been one change in the page state enum which we need to handle. These changes basically boil down to the following: - If global_page_state() is available we should use it. Several autoconf checks have been added to detect the correct enum names. - If global_page_state() is not available check to see if get_zone_counts() symbol is available and use that. - If the get_zone_counts() symbol is not exported we have no choice be to dynamically aquire it at load time. This is an absolute last resort for old kernel which we don't want to patch to cleanly export the symbol.
Diffstat (limited to 'include/sys/vmsystm.h')
-rw-r--r--include/sys/vmsystm.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h
index 75365fde0..1c367d7cd 100644
--- a/include/sys/vmsystm.h
+++ b/include/sys/vmsystm.h
@@ -123,22 +123,21 @@ extern struct pglist_data *pgdat_list_addr;
#endif /* HAVE_PGDAT_HELPERS */
/* Source linux/mm/vmstat.c */
-#ifndef HAVE_ZONE_STAT_ITEM_FIA
-# ifndef HAVE_GET_ZONE_COUNTS
+#if defined(NEED_GET_ZONE_COUNTS) && !defined(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 */
+#endif /* NEED_GET_ZONE_COUNTS && !HAVE_GET_ZONE_COUNTS */
-extern unsigned long spl_global_page_state(int);
-/* Defines designed to simulate enum but large enough to ensure no overlap */
-# define NR_FREE_PAGES 0x8001
-# define NR_INACTIVE 0x8002
-# define NR_ACTIVE 0x8003
-#else
-#define spl_global_page_state(item) global_page_state(item)
-#endif /* HAVE_ZONE_STAT_ITEM_FIA */
+typedef enum spl_zone_stat_item {
+ SPL_NR_FREE_PAGES,
+ SPL_NR_INACTIVE,
+ SPL_NR_ACTIVE,
+ SPL_NR_ZONE_STAT_ITEMS
+} spl_zone_stat_item_t;
+
+extern unsigned long spl_global_page_state(spl_zone_stat_item_t);
#define xcopyin(from, to, size) copy_from_user(to, from, size)
#define xcopyout(from, to, size) copy_to_user(to, from, size)