Re-embed multilist_t storage

This commit partially reverts changes to multilists in PR 7968
(multi-threaded spa-sync()) and adds some cache line alignments to
separate read-only multilists and heavily modified refcount's to different
cache lines.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-by: iXsystems, Inc.
Closes #12158
This commit is contained in:
Alexander Motin
2021-06-10 12:42:31 -04:00
committed by GitHub
parent eec5ba113e
commit ffdf019cb3
12 changed files with 99 additions and 104 deletions
+6 -8
View File
@@ -68,8 +68,8 @@ 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.
*/
static multilist_t *
multilist_create_impl(size_t size, size_t offset,
static void
multilist_create_impl(multilist_t *ml, size_t size, size_t offset,
unsigned int num, multilist_sublist_index_func_t *index_func)
{
ASSERT3U(size, >, 0);
@@ -77,7 +77,6 @@ multilist_create_impl(size_t size, size_t offset,
ASSERT3U(num, >, 0);
ASSERT3P(index_func, !=, NULL);
multilist_t *ml = kmem_alloc(sizeof (*ml), KM_SLEEP);
ml->ml_offset = offset;
ml->ml_num_sublists = num;
ml->ml_index_func = index_func;
@@ -92,7 +91,6 @@ multilist_create_impl(size_t size, size_t offset,
mutex_init(&mls->mls_lock, NULL, MUTEX_NOLOCKDEP, NULL);
list_create(&mls->mls_list, size, offset);
}
return (ml);
}
/*
@@ -103,8 +101,8 @@ multilist_create_impl(size_t size, size_t offset,
* reserve the RAM necessary to create the extra slots for additional CPUs up
* front, and dynamically adding them is a complex task.
*/
multilist_t *
multilist_create(size_t size, size_t offset,
void
multilist_create(multilist_t *ml, size_t size, size_t offset,
multilist_sublist_index_func_t *index_func)
{
int num_sublists;
@@ -115,7 +113,7 @@ multilist_create(size_t size, size_t offset,
num_sublists = MAX(boot_ncpus, 4);
}
return (multilist_create_impl(size, offset, num_sublists, index_func));
multilist_create_impl(ml, size, offset, num_sublists, index_func);
}
/*
@@ -141,7 +139,7 @@ multilist_destroy(multilist_t *ml)
ml->ml_num_sublists = 0;
ml->ml_offset = 0;
kmem_free(ml, sizeof (multilist_t));
ml->ml_sublists = NULL;
}
/*