+#include <libkern/OSAtomic.h>
+
+
+#include <vm/vm_options.h>
+
+#ifdef MACH_KERNEL_PRIVATE
+#include <vm/vm_page.h>
+#endif
+
+#include <sys/kdebug.h>
+
+#define VM_PAGE_AVAILABLE_COUNT() ((unsigned int)(vm_page_cleaned_count))
+
+/* externally manipulated counters */
+extern unsigned int vm_pageout_cleaned_reactivated, vm_pageout_cleaned_fault_reactivated, vm_pageout_cleaned_commit_reactivated;
+
+#if CONFIG_JETSAM
+#define LATENCY_JETSAM FALSE
+#if LATENCY_JETSAM
+#define JETSAM_LATENCY_TOKEN_AGE 3000 /* 3ms */
+#define NUM_OF_JETSAM_LATENCY_TOKENS 1000
+
+#define JETSAM_AGE_NOTIFY_CRITICAL 1500000 /* 1.5 secs */
+
+extern boolean_t jlp_init;
+extern uint64_t jlp_time, jlp_current;
+extern unsigned int latency_jetsam_wakeup;
+#endif /* LATENCY_JETSAM */
+#endif /* CONFIG_JETSAM */
+
+#if CONFIG_FREEZE
+extern boolean_t memorystatus_freeze_enabled;
+#define VM_DYNAMIC_PAGING_ENABLED(port) ((COMPRESSED_PAGER_IS_ACTIVE || DEFAULT_FREEZER_COMPRESSED_PAGER_IS_ACTIVE) || (memorystatus_freeze_enabled == FALSE && IP_VALID(port)))
+#else
+#define VM_DYNAMIC_PAGING_ENABLED(port) (COMPRESSED_PAGER_IS_ACTIVE || IP_VALID(port))
+#endif
+
+
+extern int vm_debug_events;
+
+#define VMF_CHECK_ZFDELAY 0x100
+#define VMF_COWDELAY 0x101
+#define VMF_ZFDELAY 0x102
+#define VMF_COMPRESSORDELAY 0x103
+
+#define VM_PAGEOUT_SCAN 0x104
+#define VM_PAGEOUT_BALANCE 0x105
+#define VM_PAGEOUT_FREELIST 0x106
+#define VM_PAGEOUT_PURGEONE 0x107
+#define VM_PAGEOUT_CACHE_EVICT 0x108
+#define VM_PAGEOUT_THREAD_BLOCK 0x109
+#define VM_PAGEOUT_JETSAM 0x10A
+#define VM_PAGEOUT_PAGE_TOKEN 0x10B
+
+#define VM_UPL_PAGE_WAIT 0x120
+#define VM_IOPL_PAGE_WAIT 0x121
+#define VM_PAGE_WAIT_BLOCK 0x122
+
+#define VM_PRESSURE_EVENT 0x130
+#define VM_EXECVE 0x131
+#define VM_WAKEUP_COMPACTOR_SWAPPER 0x132
+
+#define VM_DEBUG_EVENT(name, event, control, arg1, arg2, arg3, arg4) \
+ MACRO_BEGIN \
+ if (vm_debug_events) { \
+ KERNEL_DEBUG_CONSTANT((MACHDBG_CODE(DBG_MACH_VM, event)) | control, arg1, arg2, arg3, arg4, 0); \
+ } \
+ MACRO_END
+
+extern void inline memoryshot(unsigned int event, unsigned int control);
+