#include <vm/uma.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
-#include <vm/vm_pageout.h>
MALLOC_DECLARE(M_SOLARIS);
int kmem_debugging(void);
void *calloc(size_t n, size_t s);
-#define freemem (long)vm_cnt.v_free_count
-#define desfree (long)vm_cnt.v_free_target
-#define minfree (long)vm_cnt.v_free_min
-#define needfree (long)vm_pageout_deficit
+#define freemem vm_cnt.v_free_count
+#define minfree vm_cnt.v_free_min
#define heap_arena kmem_arena
#define kmem_alloc(size, kmflags) zfs_kmem_alloc((size), (kmflags))
#define kmem_zalloc(size, kmflags) zfs_kmem_alloc((size), (kmflags) | M_ZERO)
int zfs_arc_p_min_shift = 0;
uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */
u_int zfs_arc_free_target = 0;
-#define lotsfree zfs_arc_free_target
/* Absolute min for arc min / max is 16MB. */
static uint64_t arc_abs_min = 16 << 20;
}
}
+static long needfree = 0;
+
typedef enum free_memory_reason_t {
FMR_UNKNOWN,
FMR_NEEDFREE,
}
}
+ /*
+ * Cooperate with pagedaemon when it's time for it to scan
+ * and reclaim some pages.
+ */
+ n = PAGESIZE * ((int64_t)freemem - zfs_arc_free_target);
+ if (n < lowest) {
+ lowest = n;
+ r = FMR_LOTSFREE;
+ }
+
+#ifdef illumos
/*
* check that we're out of range of the pageout scanner. It starts to
* schedule paging if freemem is less than lotsfree and needfree.
r = FMR_LOTSFREE;
}
-#ifdef illumos
/*
* check to make sure that swapfs has enough space so that anon
* reservations can still succeed. anon_resvmem() checks that the
* infinite loop.
*/
if (arc_size <= arc_c || evicted == 0) {
+#ifdef _KERNEL
+ needfree = 0;
+#endif
/*
* We're either no longer overflowing, or we
* can't evict anything more, so we should wake
{
mutex_enter(&arc_reclaim_lock);
+ /* XXX: Memory deficit should be passed as argument. */
+ needfree = btoc(arc_c >> arc_shrink_shift);
DTRACE_PROBE(arc__needfree);
cv_signal(&arc_reclaim_thread_cv);