7970 zfs_arc_num_sublists_per_state should be common to all multilists
illumos/illumos-gate@10fbdecb05
10fbdecb05
https://www.illumos.org/issues/7970
The global tunable zfs_arc_num_sublists_per_state is used by the ARC and
the dbuf cache, and other users are planned. We should change this
tunable to be common to all multilists.
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>
This commit is contained in:
parent
bc390f4947
commit
260aaa4c3d
@ -21,7 +21,7 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
|
||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||
*/
|
||||
@ -296,13 +296,6 @@ uint_t arc_reduce_dnlc_percent = 3;
|
||||
*/
|
||||
int zfs_arc_evict_batch_limit = 10;
|
||||
|
||||
/*
|
||||
* The number of sublists used for each of the arc state lists. If this
|
||||
* is not set to a suitable value by the user, it will be configured to
|
||||
* the number of CPUs on the system in arc_init().
|
||||
*/
|
||||
int zfs_arc_num_sublists_per_state = 0;
|
||||
|
||||
/* number of seconds before growing cache again */
|
||||
static int arc_grow_retry = 60;
|
||||
|
||||
@ -5775,43 +5768,43 @@ arc_state_init(void)
|
||||
multilist_create(&arc_mru->arcs_list[ARC_BUFC_METADATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_mru->arcs_list[ARC_BUFC_DATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_mfu->arcs_list[ARC_BUFC_DATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA],
|
||||
sizeof (arc_buf_hdr_t),
|
||||
offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node),
|
||||
zfs_arc_num_sublists_per_state, arc_state_multilist_index_func);
|
||||
arc_state_multilist_index_func);
|
||||
|
||||
refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]);
|
||||
refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]);
|
||||
@ -5969,9 +5962,6 @@ arc_init(void)
|
||||
if (zfs_arc_p_min_shift > 0)
|
||||
arc_p_min_shift = zfs_arc_p_min_shift;
|
||||
|
||||
if (zfs_arc_num_sublists_per_state < 1)
|
||||
zfs_arc_num_sublists_per_state = MAX(boot_ncpus, 1);
|
||||
|
||||
/* if kmem_flags are set, lets try to use less memory */
|
||||
if (kmem_debugging())
|
||||
arc_c = arc_c / 2;
|
||||
|
@ -623,7 +623,6 @@ retry:
|
||||
|
||||
multilist_create(&dbuf_cache, sizeof (dmu_buf_impl_t),
|
||||
offsetof(dmu_buf_impl_t, db_cache_link),
|
||||
zfs_arc_num_sublists_per_state,
|
||||
dbuf_cache_multilist_index_func);
|
||||
refcount_create(&dbuf_cache_size);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2013, 2014 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013, 2017 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
@ -22,6 +22,12 @@
|
||||
/* needed for spa_get_random() */
|
||||
#include <sys/spa.h>
|
||||
|
||||
/*
|
||||
* This overrides the number of sublists in each multilist_t, which defaults
|
||||
* to the number of CPUs in the system (see multilist_create()).
|
||||
*/
|
||||
int zfs_multilist_num_sublists = 0;
|
||||
|
||||
/*
|
||||
* Given the object contained on the list, return a pointer to the
|
||||
* object's multilist_node_t structure it contains.
|
||||
@ -59,9 +65,9 @@ multilist_d2l(multilist_t *ml, void *obj)
|
||||
* requirement, but a general rule of thumb in order to garner the
|
||||
* best multi-threaded performance out of the data structure.
|
||||
*/
|
||||
void
|
||||
multilist_create(multilist_t *ml, size_t size, size_t offset, unsigned int num,
|
||||
multilist_sublist_index_func_t *index_func)
|
||||
static void
|
||||
multilist_create_impl(multilist_t *ml, size_t size, size_t offset,
|
||||
unsigned int num, multilist_sublist_index_func_t *index_func)
|
||||
{
|
||||
ASSERT3P(ml, !=, NULL);
|
||||
ASSERT3U(size, >, 0);
|
||||
@ -85,6 +91,26 @@ multilist_create(multilist_t *ml, size_t size, size_t offset, unsigned int num,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize a new sublist, using the default number of sublists
|
||||
* (the number of CPUs, or at least 4, or the tunable
|
||||
* zfs_multilist_num_sublists).
|
||||
*/
|
||||
void
|
||||
multilist_create(multilist_t *ml, size_t size, size_t offset,
|
||||
multilist_sublist_index_func_t *index_func)
|
||||
{
|
||||
int num_sublists;
|
||||
|
||||
if (zfs_multilist_num_sublists > 0) {
|
||||
num_sublists = zfs_multilist_num_sublists;
|
||||
} else {
|
||||
num_sublists = MAX(boot_ncpus, 4);
|
||||
}
|
||||
|
||||
multilist_create_impl(ml, size, offset, num_sublists, index_func);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy the given multilist object, and free up any memory it holds.
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012, 2017 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||
*/
|
||||
|
||||
@ -64,8 +64,6 @@ typedef void arc_done_func_t(zio_t *zio, arc_buf_t *buf, void *private);
|
||||
arc_done_func_t arc_bcopy_func;
|
||||
arc_done_func_t arc_getbuf_func;
|
||||
|
||||
extern int zfs_arc_num_sublists_per_state;
|
||||
|
||||
typedef enum arc_flags
|
||||
{
|
||||
/*
|
||||
|
@ -13,7 +13,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2013, 2014 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013, 2017 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MULTILIST_H
|
||||
@ -73,7 +73,7 @@ struct multilist {
|
||||
};
|
||||
|
||||
void multilist_destroy(multilist_t *);
|
||||
void multilist_create(multilist_t *, size_t, size_t, unsigned int,
|
||||
void multilist_create(multilist_t *, size_t, size_t,
|
||||
multilist_sublist_index_func_t *);
|
||||
|
||||
void multilist_insert(multilist_t *, void *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user