SC: Make some key size classes static.
The largest small class, smallest large class, and largest large class may all be needed down fast paths; to avoid the risk of touching another cache line, we can make them available as constants.
This commit is contained in:
committed by
David Goldblatt
parent
5112d9e5fd
commit
55e5cc1341
@@ -123,13 +123,13 @@ test_junk(size_t sz_min, size_t sz_max) {
|
||||
|
||||
TEST_BEGIN(test_junk_small) {
|
||||
test_skip_if(!config_fill);
|
||||
test_junk(1, sc_data_global.small_maxclass - 1);
|
||||
test_junk(1, SC_SMALL_MAXCLASS - 1);
|
||||
}
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_junk_large) {
|
||||
test_skip_if(!config_fill);
|
||||
test_junk(sc_data_global.small_maxclass + 1,
|
||||
test_junk(SC_SMALL_MAXCLASS + 1,
|
||||
(1U << (sc_data_global.lg_large_minclass + 1)));
|
||||
}
|
||||
TEST_END
|
||||
|
@@ -721,7 +721,7 @@ TEST_BEGIN(test_arenas_lextent_constants) {
|
||||
} while (0)
|
||||
|
||||
TEST_ARENAS_LEXTENT_CONSTANT(size_t, size,
|
||||
sc_data_global.large_minclass);
|
||||
SC_LARGE_MINCLASS);
|
||||
|
||||
#undef TEST_ARENAS_LEXTENT_CONSTANT
|
||||
}
|
||||
|
@@ -85,8 +85,8 @@ TEST_END
|
||||
|
||||
TEST_BEGIN(test_rtree_extrema) {
|
||||
extent_t extent_a, extent_b;
|
||||
extent_init(&extent_a, NULL, NULL, sc_data_global.large_minclass, false,
|
||||
sz_size2index(sc_data_global.large_minclass), 0,
|
||||
extent_init(&extent_a, NULL, NULL, SC_LARGE_MINCLASS, false,
|
||||
sz_size2index(SC_LARGE_MINCLASS), 0,
|
||||
extent_state_active, false, false, true);
|
||||
extent_init(&extent_b, NULL, NULL, 0, false, SC_NSIZES, 0,
|
||||
extent_state_active, false, false, true);
|
||||
|
@@ -33,7 +33,7 @@ TEST_BEGIN(test_stats_large) {
|
||||
size_t sz;
|
||||
int expected = config_stats ? 0 : ENOENT;
|
||||
|
||||
p = mallocx(sc_data_global.small_maxclass + 1, MALLOCX_ARENA(0));
|
||||
p = mallocx(SC_SMALL_MAXCLASS + 1, MALLOCX_ARENA(0));
|
||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||
|
||||
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||
@@ -74,7 +74,7 @@ TEST_BEGIN(test_stats_arenas_summary) {
|
||||
uint64_t dirty_npurge, dirty_nmadvise, dirty_purged;
|
||||
uint64_t muzzy_npurge, muzzy_nmadvise, muzzy_purged;
|
||||
|
||||
little = mallocx(sc_data_global.small_maxclass, MALLOCX_ARENA(0));
|
||||
little = mallocx(SC_SMALL_MAXCLASS, MALLOCX_ARENA(0));
|
||||
assert_ptr_not_null(little, "Unexpected mallocx() failure");
|
||||
large = mallocx((1U << sc_data_global.lg_large_minclass),
|
||||
MALLOCX_ARENA(0));
|
||||
@@ -149,7 +149,7 @@ TEST_BEGIN(test_stats_arenas_small) {
|
||||
|
||||
no_lazy_lock(); /* Lazy locking would dodge tcache testing. */
|
||||
|
||||
p = mallocx(sc_data_global.small_maxclass, MALLOCX_ARENA(0));
|
||||
p = mallocx(SC_SMALL_MAXCLASS, MALLOCX_ARENA(0));
|
||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||
|
||||
assert_d_eq(mallctl("thread.tcache.flush", NULL, NULL, NULL, 0),
|
||||
|
@@ -41,13 +41,13 @@ test_zero(size_t sz_min, size_t sz_max) {
|
||||
|
||||
TEST_BEGIN(test_zero_small) {
|
||||
test_skip_if(!config_fill);
|
||||
test_zero(1, sc_data_global.small_maxclass - 1);
|
||||
test_zero(1, SC_SMALL_MAXCLASS - 1);
|
||||
}
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_zero_large) {
|
||||
test_skip_if(!config_fill);
|
||||
test_zero(sc_data_global.small_maxclass + 1,
|
||||
test_zero(SC_SMALL_MAXCLASS + 1,
|
||||
1U << (sc_data_global.lg_large_minclass + 1));
|
||||
}
|
||||
TEST_END
|
||||
|
Reference in New Issue
Block a user