* the boot-arg & device-tree code.
*/
-#if CONFIG_EMBEDDED
+#if !XNU_TARGET_OS_OSX
#if CONFIG_FREEZE
int vm_compressor_mode = VM_PAGER_FREEZER_DEFAULT;
int vm_compressor_mode = VM_PAGER_NOT_CONFIGURED;
#endif /* CONFIG_FREEZE */
-#else /* CONFIG_EMBEDDED */
+#else /* !XNU_TARGET_OS_OSX */
int vm_compressor_mode = VM_PAGER_COMPRESSOR_WITH_SWAP;
-#endif /* CONFIG_EMBEDDED */
+#endif /* !XNU_TARGET_OS_OSX */
TUNABLE(uint32_t, vm_compression_limit, "vm_compression_limit", 0);
int vm_compressor_is_active = 0;
static void vm_compressor_compact_and_swap(boolean_t);
static void vm_compressor_age_swapped_in_segments(boolean_t);
-#if !CONFIG_EMBEDDED
+#if XNU_TARGET_OS_OSX
static void vm_compressor_take_paging_space_action(void);
-#endif
+#endif /* XNU_TARGET_OS_OSX */
void compute_swapout_target_age(void);
TUNABLE(bool, kill_on_no_paging_space, "-kill_on_no_paging_space", false);
#endif /* DEVELOPMENT || DEBUG */
-#if !CONFIG_EMBEDDED
+#if XNU_TARGET_OS_OSX
static uint32_t no_paging_space_action_in_progress = 0;
extern void memorystatus_send_low_swap_note(void);
}
}
}
-#endif /* !CONFIG_EMBEDDED */
+#endif /* XNU_TARGET_OS_OSX */
void
assert((C_SEGMENTS_PER_PAGE * sizeof(union c_segu)) == PAGE_SIZE);
-#ifdef CONFIG_EMBEDDED
+#if !XNU_TARGET_OS_OSX
vm_compressor_minorcompact_threshold_divisor = 20;
vm_compressor_majorcompact_threshold_divisor = 30;
vm_compressor_unthrottle_threshold_divisor = 40;
vm_compressor_catchup_threshold_divisor = 60;
-#else
+#else /* !XNU_TARGET_OS_OSX */
if (max_mem <= (3ULL * 1024ULL * 1024ULL * 1024ULL)) {
vm_compressor_minorcompact_threshold_divisor = 11;
vm_compressor_majorcompact_threshold_divisor = 13;
vm_compressor_unthrottle_threshold_divisor = 35;
vm_compressor_catchup_threshold_divisor = 50;
}
-#endif
+#endif /* !XNU_TARGET_OS_OSX */
queue_init(&c_bad_list_head);
queue_init(&c_age_list_head);
compressor_pool_max_size = C_SEG_MAX_LIMIT;
compressor_pool_max_size *= C_SEG_BUFSIZE;
-#if !CONFIG_EMBEDDED
+#if XNU_TARGET_OS_OSX
if (vm_compression_limit == 0) {
if (max_mem <= (4ULL * 1024ULL * 1024ULL * 1024ULL)) {
{
int old_state = c_seg->c_state;
-#if !CONFIG_EMBEDDED
+#if XNU_TARGET_OS_OSX
#if DEVELOPMENT || DEBUG
if (new_state != C_IS_FILLING) {
LCK_MTX_ASSERT(&c_seg->c_lock, LCK_MTX_ASSERT_OWNED);
}
LCK_MTX_ASSERT(c_list_lock, LCK_MTX_ASSERT_OWNED);
#endif
-#endif /* !CONFIG_EMBEDDED */
+#endif /* XNU_TARGET_OS_OSX */
switch (old_state) {
case C_IS_EMPTY:
assert(new_state == C_IS_FILLING || new_state == C_IS_FREE);
goto check_if_low_space;
}
}
+
+#if (XNU_TARGET_OS_OSX && __arm64__)
+ /*
+ * Thrashing detection disabled.
+ */
+#else /* (XNU_TARGET_OS_OSX && __arm64__) */
+
compute_swapout_target_age();
if (swapout_target_age) {
if (swapout_target_age) {
should_swap = TRUE;
}
+#endif /* (XNU_TARGET_OS_OSX && __arm64__) */
check_if_low_space:
VM_DEBUG_CONSTANT_EVENT(vm_compressor_do_delayed_compactions, VM_COMPRESSOR_DO_DELAYED_COMPACTIONS, DBG_FUNC_START, c_minor_count, flush_all, 0, 0);
-#if !CONFIG_EMBEDDED
+#if XNU_TARGET_OS_OSX
LCK_MTX_ASSERT(c_list_lock, LCK_MTX_ASSERT_OWNED);
-#endif /* !CONFIG_EMBEDDED */
+#endif /* XNU_TARGET_OS_OSX */
while (!queue_empty(&c_minor_list_head) && needs_to_swap == FALSE) {
c_seg = (c_segment_t)queue_first(&c_minor_list_head);
int min_needed;
int size_to_populate;
-#if !CONFIG_EMBEDDED
+#if XNU_TARGET_OS_OSX
if (vm_compressor_low_on_space()) {
vm_compressor_take_paging_space_action();
}
-#endif /* !CONFIG_EMBEDDED */
+#endif /* XNU_TARGET_OS_OSX */
if ((c_seg = *current_chead) == NULL) {
uint32_t c_segno;
vm_swap_consider_defragmenting(VM_SWAP_FLAGS_NONE);
}
-#if CONFIG_EMBEDDED
+#if !XNU_TARGET_OS_OSX
if ((c_minor_count && COMPRESSOR_NEEDS_TO_MINOR_COMPACT()) || vm_compressor_needs_to_major_compact()) {
vm_wake_compactor_swapper();
}
-#endif
+#endif /* !XNU_TARGET_OS_OSX */
return retval;
}