svn commit: r197530 -
user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Kip Macy
kmacy at FreeBSD.org
Sat Sep 26 20:43:01 UTC 2009
Author: kmacy
Date: Sat Sep 26 20:43:00 2009
New Revision: 197530
URL: http://svn.freebsd.org/changeset/base/197530
Log:
- rather than evicting from one list and skewing the weighting, evict one buffer from each list
until we've examined all buffers or we've hit the eviction target
- never evict if we're below arc_min
- always evict if we'r above arc_max
Modified:
user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 26 20:07:48 2009 (r197529)
+++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 26 20:43:00 2009 (r197530)
@@ -1520,6 +1520,7 @@ arc_evict(arc_state_t *state, spa_t *spa
{
arc_state_t *evicted_state;
uint64_t bytes_evicted = 0, skipped = 0, missed = 0;
+ int64_t bytes_remaining;
arc_buf_hdr_t *ab, *ab_prev = NULL;
list_t *evicted_list, *list, *evicted_list_start, *list_start;
kmutex_t *lock, *evicted_lock;
@@ -1533,6 +1534,7 @@ arc_evict(arc_state_t *state, spa_t *spa
evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost;
+ bytes_remaining = evicted_state->arcs_lsize[ab->b_type];
if (type == ARC_BUFC_METADATA) {
offset = 0;
list_count = ARC_BUFC_NUMMETADATALISTS;
@@ -1560,6 +1562,7 @@ evict_start:
for (ab = list_tail(list); ab; ab = ab_prev) {
ab_prev = list_prev(list, ab);
+ bytes_remaining -= (ab->b_size * ab->b_datacnt);
/* prefetch buffers have a minimum lifespan */
if (HDR_IO_IN_PROGRESS(ab) ||
(spa && ab->b_spa != spa) ||
@@ -1619,6 +1622,13 @@ evict_start:
mutex_exit(hash_lock);
if (bytes >= 0 && bytes_evicted >= bytes)
break;
+ if (bytes_remaining > 0) {
+ mutex_exit(evicted_lock);
+ mutex_exit(lock);
+ idx = ((idx + 1)&(list_count-1));
+ count++;
+ goto evict_start;
+ }
} else {
missed += 1;
}
@@ -1940,6 +1950,12 @@ arc_reclaim_needed(void)
#endif
#ifdef _KERNEL
+ if (needfree)
+ return (1);
+ if (arc_size > arc_c_max)
+ return (1);
+ if (arc_size <= arc_c_min)
+ return (0);
/*
* If pages are needed or we're within 2048 pages
@@ -1948,9 +1964,6 @@ arc_reclaim_needed(void)
if (vm_pages_needed || (vm_paging_target() > -2048))
return (1);
- if (needfree)
- return (1);
-
#if 0
/*
* take 'desfree' extra pages, so we reclaim sooner, rather than later
More information about the svn-src-user
mailing list