From d14487a763e826bbf809f4138bc8273511cf3506 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 10:15:25 -0800 Subject: [PATCH 1/8] Refresh linux-arc --- .topdeps | 4 +--- .topmsg | 17 ++--------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/.topdeps b/.topdeps index 607c231780..7f16cbcdd5 100644 --- a/.topdeps +++ b/.topdeps @@ -1,3 +1 @@ -gcc-branch -fix-branch -feature-branch +zfs-branch diff --git a/.topmsg b/.topmsg index e9722e1075..f0b4e43e63 100644 --- a/.topmsg +++ b/.topmsg @@ -1,19 +1,6 @@ From: Brian Behlendorf -Subject: [PATCH] zfs branch +Subject: [PATCH] linux-arc -Merged result of all changes which are relevant to both Solaris -and Linux builds of the ZFS code. These are changes where there -is a reasonable chance they will be accepted upstream. - -Additionally, since this is effectively the root of the linux -ZFS tree the core linux build system is added here. This -includes autogen.sh, configure.ac, m4 macros, some scripts/*, -and makefiles for all the core ZFS components. Linux-only -features which require tweaks to the build system should appear -on the relevant topic branches. All autotools products which -result from autogen.sh are commited to the linux-configure-branch. - -This branch also contains the META, ChangeLog, AUTHORS, -README, and GIT files. + Signed-off-by: Brian Behlendorf From cb740a3631a8c64d916a6113404e04045f5f1423 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 23 Dec 2008 16:09:45 -0800 Subject: [PATCH 2/8] Linux ARC integration unimplemented --- module/zfs/arc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 392bf417c4..b2d35d0b25 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1787,9 +1787,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); @@ -1834,12 +1836,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); } @@ -1853,6 +1855,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. @@ -1860,13 +1863,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 @@ -2017,6 +2021,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 @@ -2026,7 +2031,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); @@ -3248,6 +3254,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); @@ -3259,6 +3266,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) { From ae960c7bbcc749d991de1855532d179fd22b3219 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 23 Dec 2008 16:32:42 -0800 Subject: [PATCH 3/8] This doesn't quite work with the SPL yet --- module/zfs/arc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index b2d35d0b25..f67a92d807 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -3359,8 +3359,10 @@ arc_init(void) * than the addressable space (intel in 32-bit mode), we may * need to limit the cache to 1/8 of VM size. */ +#ifndef HAVE_SPL arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8); -#endif +#endif /* HAVE_SPL */ +#endif /* _KERNEL */ /* set min cache to 1/32 of all memory, or 64MB, whichever is more */ arc_c_min = MAX(arc_c / 4, 64<<20); From 102e8285d3527774cbb8e59e42ea11ea1eaab287 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 14 Jan 2009 13:42:45 -0800 Subject: [PATCH 4/8] Update topmsg --- .topmsg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.topmsg b/.topmsg index f0b4e43e63..be5391622d 100644 --- a/.topmsg +++ b/.topmsg @@ -1,6 +1,6 @@ From: Brian Behlendorf -Subject: [PATCH] linux-arc +Subject: [PATCH] linux arc - +Linux VM arc integration. Signed-off-by: Brian Behlendorf From 770152bd1d864184e3a56f44e03b39880bed2081 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 4 Feb 2009 15:19:19 -0800 Subject: [PATCH 5/8] Revert current code removal changes, this support now exists in the SPL. The branch is being left in place because I expect there to be other new changes soon --- module/zfs/arc.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 4988b74d07..e9c0730aee 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1789,12 +1789,10 @@ arc_shrink(void) static int arc_reclaim_needed(void) { -#ifdef _KERNEL -#ifdef HAVE_SPL - /* FIXME: Linux VM integration */ -#else uint64_t extra; +#ifdef _KERNEL + if (needfree) return (1); @@ -1838,12 +1836,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 /* __i386 */ -#endif /* HAVE_SPL */ +#endif + #else if (spa_get_random(100) == 0) return (1); -#endif /* _KERNEL */ +#endif return (0); } @@ -1857,7 +1855,6 @@ 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. @@ -1865,14 +1862,13 @@ 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 /* __i386 */ -#endif /* _KERNEL */ +#endif +#endif /* * An aggressive reclamation will shrink the cache size as well as @@ -2023,7 +2019,6 @@ 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 @@ -2033,8 +2028,7 @@ arc_evict_needed(arc_buf_contents_t type) vmem_size(zio_arena, VMEM_FREE) < (vmem_size(zio_arena, VMEM_ALLOC) >> 5)) return (1); -#endif /* HAVE_SPL */ -#endif /* _KERNEL */ +#endif if (arc_reclaim_needed()) return (1); @@ -3256,7 +3250,6 @@ 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); @@ -3268,7 +3261,6 @@ 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) { @@ -3361,10 +3353,8 @@ arc_init(void) * than the addressable space (intel in 32-bit mode), we may * need to limit the cache to 1/8 of VM size. */ -#ifndef HAVE_SPL arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8); -#endif /* HAVE_SPL */ -#endif /* _KERNEL */ +#endif /* set min cache to 1/32 of all memory, or 64MB, whichever is more */ arc_c_min = MAX(arc_c / 4, 64<<20); From c3ec929baf0797a48935e9035fc11d44e0dd535e Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 6 Feb 2009 10:09:20 -0800 Subject: [PATCH 6/8] Ensure vmem_size() calculations are only used on __i386 or we will missize the arch cache on 64bit machines with the SPL. This change should probably be there in the Solaris version as well. --- module/zfs/arc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index e9c0730aee..5e4759ae15 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -3347,7 +3347,7 @@ arc_init(void) /* Start out with 1/8 of all memory */ arc_c = physmem * PAGESIZE / 8; -#ifdef _KERNEL +#if defined(_KERNEL) && defined(__i386) /* * On architectures where the physical memory can be larger * than the addressable space (intel in 32-bit mode), we may From 4e4327a0a5cc845f597cae506a64689095e77e30 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sat, 7 Feb 2009 13:10:16 -0800 Subject: [PATCH 7/8] Drop the KERNEL portion of this check, just checking __i386 is correct --- module/zfs/arc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 5e4759ae15..67f91fec46 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -3347,7 +3347,7 @@ arc_init(void) /* Start out with 1/8 of all memory */ arc_c = physmem * PAGESIZE / 8; -#if defined(_KERNEL) && defined(__i386) +#if defined(__i386) /* * On architectures where the physical memory can be larger * than the addressable space (intel in 32-bit mode), we may From 7bca8f19264c69adaaa370b7da3e565ce5dd22e8 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 16 Mar 2009 11:27:26 -0700 Subject: [PATCH 8/8] Use vmem_size() only on i386 systems and in the kernel. --- module/zfs/arc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 6292121ed3..b416907b65 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -3437,7 +3437,7 @@ arc_init(void) /* Start out with 1/8 of all memory */ arc_c = physmem * PAGESIZE / 8; -#if defined(__i386) +#if defined(_KERNEL) && defined(__i386) /* * On architectures where the physical memory can be larger * than the addressable space (intel in 32-bit mode), we may