remove the poor emulation of the IllumOS needfree global variable to prevent
the ARC reclaim thread running longer than needed. Update the arc::needfree dtrace probe triggered in arc_lowmem() to also report the value we may want to free. Submitted by: Nikita Kozlov <nikita.kozlov at blade-group.com> Reviewed by: avg Approved by: avg MFC after: 3 weeks Sponsored by: blade Differential Revision: https://reviews.freebsd.org/D12163
This commit is contained in:
parent
58c8430a32
commit
c07d14deb5
@ -4199,8 +4199,6 @@ arc_shrink(int64_t to_free)
|
||||
}
|
||||
}
|
||||
|
||||
static long needfree = 0;
|
||||
|
||||
typedef enum free_memory_reason_t {
|
||||
FMR_UNKNOWN,
|
||||
FMR_NEEDFREE,
|
||||
@ -4238,14 +4236,6 @@ arc_available_memory(void)
|
||||
free_memory_reason_t r = FMR_UNKNOWN;
|
||||
|
||||
#ifdef _KERNEL
|
||||
if (needfree > 0) {
|
||||
n = PAGESIZE * (-needfree);
|
||||
if (n < lowest) {
|
||||
lowest = n;
|
||||
r = FMR_NEEDFREE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Cooperate with pagedaemon when it's time for it to scan
|
||||
* and reclaim some pages.
|
||||
@ -4510,9 +4500,6 @@ arc_reclaim_thread(void *dummy __unused)
|
||||
int64_t to_free =
|
||||
(arc_c >> arc_shrink_shift) - free_memory;
|
||||
if (to_free > 0) {
|
||||
#ifdef _KERNEL
|
||||
to_free = MAX(to_free, ptob(needfree));
|
||||
#endif
|
||||
arc_shrink(to_free);
|
||||
}
|
||||
} else if (free_memory < arc_c >> arc_no_grow_shift) {
|
||||
@ -4533,9 +4520,6 @@ arc_reclaim_thread(void *dummy __unused)
|
||||
* 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
|
||||
@ -6310,9 +6294,7 @@ arc_lowmem(void *arg __unused, int howto __unused)
|
||||
{
|
||||
|
||||
mutex_enter(&arc_reclaim_lock);
|
||||
/* XXX: Memory deficit should be passed as argument. */
|
||||
needfree = btoc(arc_c >> arc_shrink_shift);
|
||||
DTRACE_PROBE(arc__needfree);
|
||||
DTRACE_PROBE1(arc__needfree, int64_t, ((int64_t)freemem - zfs_arc_free_target) * PAGESIZE);
|
||||
cv_signal(&arc_reclaim_thread_cv);
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user