Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
- index b593792..4c56163 100644
- --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
- +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
- @@ -183,10 +183,15 @@ int zfs_arc_grow_retry = 0;
- int zfs_arc_shrink_shift = 0;
- int zfs_arc_p_min_shift = 0;
- +uint64_t zfs_arc_bp_active;
- +uint64_t zfs_arc_bp_inactive;
- +
- TUNABLE_QUAD("vfs.zfs.arc_max", &zfs_arc_max);
- TUNABLE_QUAD("vfs.zfs.arc_min", &zfs_arc_min);
- TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &zfs_arc_meta_limit);
- TUNABLE_INT("vfs.zfs.mdcomp_disable", &zfs_mdcomp_disable);
- +TUNABLE_QUAD("vfs.zfs.arc_bp_active", &zfs_arc_bp_active);
- +TUNABLE_QUAD("vfs.zfs.arc_bp_inactive", &zfs_arc_bp_inactive);
- SYSCTL_DECL(_vfs_zfs);
- SYSCTL_QUAD(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RDTUN, &zfs_arc_max, 0,
- "Maximum ARC size");
- @@ -195,6 +200,11 @@ SYSCTL_QUAD(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RDTUN, &zfs_arc_min, 0,
- SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG_RDTUN,
- &zfs_mdcomp_disable, 0, "Disable metadata compression");
- +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, arc_bp_active, CTLFLAG_RW|CTLFLAG_TUN, &zfs_arc_bp_active, 0,
- + "Start ARC backpressure if active memory is below this limit");
- +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, arc_bp_inactive, CTLFLAG_RW|CTLFLAG_TUN, &zfs_arc_bp_inactive, 0,
- + "Start ARC backpressure if inactive memory is below this limit");
- +
- /*
- * Note that buffers can be in one of 6 states:
- * ARC_anon - anonymous (discussed below)
- @@ -2105,7 +2115,6 @@ arc_shrink(void)
- }
- static int needfree = 0;
- -
- static int
- arc_reclaim_needed(void)
- {
- @@ -2114,20 +2123,58 @@ arc_reclaim_needed(void)
- #endif
- #ifdef _KERNEL
- - if (needfree)
- - return (1);
- + /* We've grown too much, */
- if (arc_size > arc_c_max)
- - return (1);
- + return (1);
- +
- + /* Pagedaemon is stuck, let's free something right away */
- + if (vm_pageout_pages_needed)
- + return 1;
- +
- + /* Check if inactive list have grown too much */
- + if ( zfs_arc_bp_inactive
- + && (ptoa((uintmax_t)cnt.v_inactive_count) > zfs_arc_bp_inactive)) {
- + /* tell pager to reap 1/2th of inactive queue*/
- + atomic_add_int(&vm_pageout_deficit, cnt.v_inactive_count/2);
- + pagedaemon_wakeup();
- + return needfree;
- + }
- +
- + /* Same for active list... */
- + if ( zfs_arc_bp_active
- + && (ptoa((uintmax_t)cnt.v_active_count) > zfs_arc_bp_active)) {
- + atomic_add_int(&vm_pageout_deficit, cnt.v_active_count/2);
- + pagedaemon_wakeup();
- + return needfree;
- + }
- +
- +
- + /* Old style behavior -- ARC gives up memory whenever page daemon asks.. */
- + if (needfree)
- + return 1;
- +
- + /*
- + We got here either because active/inactive lists are
- + getting short or because we've been called during voluntary
- + ARC size checks. Kind of gray area...
- + */
- +
- + /* If we didn't reach our minimum yet, don't rush to give memory up..*/
- if (arc_size <= arc_c_min)
- return (0);
- - /*
- - * If pages are needed or we're within 2048 pages
- - * of needing to page need to reclaim
- + /* If we're really short on memory now, give it up. */
- + if (vm_page_count_min()) {
- + return (1);
- + }
- +
- + /*
- + * If we're within 2048 pages of pagedaemon start, reclaim...
- */
- - if (vm_pages_needed || (vm_paging_target() > -2048))
- + if (vm_pages_needed && (vm_paging_target() > -2048))
- return (1);
- +
- #if 0
- /*
- * take 'desfree' extra pages, so we reclaim sooner, rather than later
- @@ -2171,8 +2218,6 @@ arc_reclaim_needed(void)
- return (1);
- #endif
- #else
- - if (kmem_used() > (kmem_size() * 3) / 4)
- - return (1);
- #endif
- #else
- @@ -2281,7 +2326,7 @@ arc_reclaim_thread(void *dummy __unused)
- if (arc_eviction_list != NULL)
- arc_do_user_evicts();
- - if (arc_reclaim_needed()) {
- + if (needfree) {
- needfree = 0;
- #ifdef _KERNEL
- wakeup(&needfree);
- @@ -3613,10 +3658,15 @@ arc_memory_throttle(uint64_t reserve, uint64_t txg)
- {
- #ifdef _KERNEL
- uint64_t inflight_data = arc_anon->arcs_size;
- - uint64_t available_memory = ptoa((uintmax_t)cnt.v_free_count);
- + uint64_t available_memory;
- static uint64_t page_load = 0;
- static uint64_t last_txg = 0;
- + /* How much memory is potentially available */
- + available_memory = ptoa((uintmax_t)cnt.v_free_count);
- + available_memory += ptoa((uintmax_t)cnt.v_cache_count);
- + available_memory -= ptoa((uintmax_t)cnt.v_free_min);
- +
- #if 0
- #if defined(__i386)
- available_memory =
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement