Merge branch 'linux-arc' into refs/top-bases/linux-zfs-branch

This commit is contained in:
Brian Behlendorf 2008-12-23 16:13:36 -08:00
commit 4dc3268de4
1 changed files with 16 additions and 8 deletions

View File

@ -1801,9 +1801,11 @@ arc_shrink(void)
static int
arc_reclaim_needed(void)
{
uint64_t extra;
#ifdef _KERNEL
#ifdef HAVE_SPL
/* FIXME: Linux VM integration */
#else
uint64_t extra;
if (needfree)
return (1);
@ -1848,12 +1850,12 @@ arc_reclaim_needed(void)
if (btop(vmem_size(heap_arena, VMEM_FREE)) <
(btop(vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC)) >> 2))
return (1);
#endif
#endif /* __i386 */
#endif /* HAVE_SPL */
#else
if (spa_get_random(100) == 0)
return (1);
#endif
#endif /* _KERNEL */
return (0);
}
@ -1867,6 +1869,7 @@ arc_kmem_reap_now(arc_reclaim_strategy_t strat)
extern kmem_cache_t *zio_data_buf_cache[];
#ifdef _KERNEL
#ifndef HAVE_SPL
if (arc_meta_used >= arc_meta_limit) {
/*
* We are exceeding our meta-data cache limit.
@ -1874,13 +1877,14 @@ arc_kmem_reap_now(arc_reclaim_strategy_t strat)
*/
dnlc_reduce_cache((void *)(uintptr_t)arc_reduce_dnlc_percent);
}
#endif /* HAVE_SPL */
#if defined(__i386)
/*
* Reclaim unused memory from all kmem caches.
*/
kmem_reap();
#endif
#endif
#endif /* __i386 */
#endif /* _KERNEL */
/*
* An aggressive reclamation will shrink the cache size as well as
@ -2031,6 +2035,7 @@ arc_evict_needed(arc_buf_contents_t type)
return (1);
#ifdef _KERNEL
#ifndef HAVE_SPL
/*
* If zio data pages are being allocated out of a separate heap segment,
* then enforce that the size of available vmem for this area remains
@ -2040,7 +2045,8 @@ arc_evict_needed(arc_buf_contents_t type)
vmem_size(zio_arena, VMEM_FREE) <
(vmem_size(zio_arena, VMEM_ALLOC) >> 5))
return (1);
#endif
#endif /* HAVE_SPL */
#endif /* _KERNEL */
if (arc_reclaim_needed())
return (1);
@ -3262,6 +3268,7 @@ arc_memory_throttle(uint64_t reserve, uint64_t txg)
* the arc is already going to be evicting, so we just want to
* continue to let page writes occur as quickly as possible.
*/
#ifndef HAVE_SPL
if (curproc == proc_pageout) {
if (page_load > MAX(ptob(minfree), available_memory) / 4)
return (ERESTART);
@ -3273,6 +3280,7 @@ arc_memory_throttle(uint64_t reserve, uint64_t txg)
ARCSTAT_INCR(arcstat_memory_throttle_count, 1);
return (EAGAIN);
}
#endif /* HAVE_SPL */
page_load = 0;
if (arc_size > arc_c_min) {