Skip to content

Commit

Permalink
Illumos 5376 - arc_kmem_reap_now() should not result in clearing arc_…
Browse files Browse the repository at this point in the history
…no_grow

5376 arc_kmem_reap_now() should not result in clearing arc_no_grow
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5376
  illumos/illumos-gate@2ec99e3

Porting Notes:

The good news is that many of the recent changes made upstream to the
ARC tackled issues previously observed by ZoL with similar solutions.
The bad news is those solution weren't identical to the ones we applied.
This patch is designed to split the difference and apply as much of the
upstream work as possible.

* The arc_available_memory() function was removed previous in ZoL but
due to the upstream changes it makes sense to add it back.  This function
has been customized for Linux so that it can be used to determine a low
memory.  This provides the same basic functionality as the illumos version
allowing us to minimize changes through the rest of the code base.  The
exact mechanism used to detect a low memory state remains unchanged so
this change isn't a significant as it might first appear.

* This patch includes the long standing fix for arc_shrink() which was
originally proposed in openzfs#2167.  Since there were related changes to this
function it made sense to include that work.

* The arc_init() function has been re-factored.  As before it sets sane
default values for the ARC but then calls arc_tuning_update() to apply
user specific tuning made via module options.  The arc_tuning_update()
function is then called periodically by the arc_reclaim_thread() to
apply changes to the tunings made during normal operation.

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#3616
Closes openzfs#2167
  • Loading branch information
ahrens authored and kernelOfTruth committed Jul 23, 2015
1 parent 512cdf6 commit 09ecc7c
Show file tree
Hide file tree
Showing 3 changed files with 374 additions and 157 deletions.
5 changes: 4 additions & 1 deletion include/sys/zfs_context.h
Expand Up @@ -410,9 +410,12 @@ extern void kstat_set_raw_ops(kstat_t *ksp,
#define kmem_debugging() 0
#define kmem_cache_reap_now(_c) umem_cache_reap_now(_c);
#define kmem_cache_set_move(_c, _cb) /* nothing */
#define vmem_qcache_reap(_v) /* nothing */
#define POINTER_INVALIDATE(_pp) /* nothing */
#define POINTER_IS_VALID(_p) 0

extern vmem_t *zio_arena;

typedef umem_cache_t kmem_cache_t;

typedef enum kmem_cbrc {
Expand Down Expand Up @@ -610,7 +613,7 @@ extern void delay(clock_t ticks);
} while (0);

#define max_ncpus 64
#define num_online_cpus() (sysconf(_SC_NPROCESSORS_ONLN))
#define boot_ncpus (sysconf(_SC_NPROCESSORS_ONLN))

#define minclsyspri 60
#define maxclsyspri 99
Expand Down
1 change: 1 addition & 0 deletions lib/libzpool/kernel.c
Expand Up @@ -48,6 +48,7 @@ uint64_t physmem;
vnode_t *rootdir = (vnode_t *)0xabcd1234;
char hw_serial[HW_HOSTID_LEN];
struct utsname hw_utsname;
vmem_t *zio_arena = NULL;

/* this only exists to have its address taken */
struct proc p0;
Expand Down

0 comments on commit 09ecc7c

Please sign in to comment.