Changeset View
Changeset View
Standalone View
Standalone View
/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Context not available. | |||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
if (needfree > 0) { | if (needfree > 0) { | ||||
n = (int64_t)vm_cnt.v_free_target - (int64_t)vm_cnt.v_free_count; | |||||
needfree = n > 0 ? n : 0; | |||||
} | |||||
if (needfree > 0) { | |||||
n = PAGESIZE * (-needfree); | n = PAGESIZE * (-needfree); | ||||
if (n < lowest) { | if (n < lowest) { | ||||
lowest = n; | lowest = n; | ||||
Context not available. | |||||
* Cooperate with pagedaemon when it's time for it to scan | * Cooperate with pagedaemon when it's time for it to scan | ||||
* and reclaim some pages. | * and reclaim some pages. | ||||
*/ | */ | ||||
n = PAGESIZE * ((int64_t)freemem - zfs_arc_free_target); | n = PAGESIZE * ((int64_t)freemem - (int64_t)zfs_arc_free_target - (int64_t)vm_cnt.v_free_reserved); | ||||
if (n < lowest) { | if (n < lowest) { | ||||
lowest = n; | lowest = n; | ||||
r = FMR_LOTSFREE; | r = FMR_LOTSFREE; | ||||
Context not available. | |||||
mutex_enter(&arc_reclaim_lock); | mutex_enter(&arc_reclaim_lock); | ||||
while (!arc_reclaim_thread_exit) { | while (!arc_reclaim_thread_exit) { | ||||
int64_t free_memory = arc_available_memory(); | |||||
uint64_t evicted = 0; | uint64_t evicted = 0; | ||||
mutex_exit(&arc_reclaim_lock); | mutex_exit(&arc_reclaim_lock); | ||||
/* | |||||
* We call arc_adjust() before (possibly) calling | |||||
* arc_kmem_reap_now(), so that we can wake up | |||||
* arc_get_data_buf() sooner. | |||||
*/ | |||||
evicted = arc_adjust(); | |||||
int64_t free_memory = arc_available_memory(); | |||||
if (free_memory < 0) { | if (free_memory < 0) { | ||||
arc_no_grow = B_TRUE; | arc_no_grow = B_TRUE; | ||||
Context not available. | |||||
to_free = MAX(to_free, ptob(needfree)); | to_free = MAX(to_free, ptob(needfree)); | ||||
#endif | #endif | ||||
arc_shrink(to_free); | arc_shrink(to_free); | ||||
arc_kmem_reap_now(); | |||||
} | } | ||||
} else if (free_memory < arc_c >> arc_no_grow_shift) { | } else if (free_memory < arc_c >> arc_no_grow_shift) { | ||||
arc_no_grow = B_TRUE; | arc_no_grow = B_TRUE; | ||||
Context not available. | |||||
arc_no_grow = B_FALSE; | arc_no_grow = B_FALSE; | ||||
} | } | ||||
evicted = arc_adjust(); | |||||
mutex_enter(&arc_reclaim_lock); | mutex_enter(&arc_reclaim_lock); | ||||
/* | /* | ||||
Context not available. | |||||
mutex_enter(&arc_reclaim_lock); | mutex_enter(&arc_reclaim_lock); | ||||
/* XXX: Memory deficit should be passed as argument. */ | /* XXX: Memory deficit should be passed as argument. */ | ||||
needfree = btoc(arc_c >> arc_shrink_shift); | needfree = (int64_t)vm_cnt.v_free_target - (int64_t)vm_cnt.v_free_count; | ||||
if(needfree <= 0) needfree = vm_cnt.v_free_target >> 8; | |||||
DTRACE_PROBE(arc__needfree); | DTRACE_PROBE(arc__needfree); | ||||
cv_signal(&arc_reclaim_thread_cv); | cv_signal(&arc_reclaim_thread_cv); | ||||
/* | |||||
* It is unsafe to block here in arbitrary threads, because we can come | |||||
* here from ARC itself and may hold ARC locks and thus risk a deadlock | |||||
* with ARC reclaim thread. | |||||
*/ | |||||
if (curproc == pageproc) | |||||
allanjude: Are we sure it is safe to remove this comment and accompanying code? | |||||
slw_zxy.spb.ruAuthorUnsubmitted Not Done Inline ActionsI am consalting w/ avg and yes, I am sure. slw_zxy.spb.ru: I am consalting w/ avg and yes, I am sure.
This code currently send all pressure to ARC, w/o… | |||||
(void) cv_wait(&arc_reclaim_waiters_cv, &arc_reclaim_lock); | |||||
mutex_exit(&arc_reclaim_lock); | mutex_exit(&arc_reclaim_lock); | ||||
} | } | ||||
#endif | #endif | ||||
Context not available. |
Are we sure it is safe to remove this comment and accompanying code?