gbmap: Added gc_repoplookahead_thresh and gc_repopgbmap_thresh
To allow relaxing when LFS3_I_REPOPLOOKAHEAD and LFS3_I_REPOPGBMAP will
be set, potentially reducing gc workload after allocating only a couple
blocks.
The relevant cfg comments have quite a bit more info.
Note -1 (not the default, 0, maybe we should explicitly flip this?)
restores the previous functionality of setting these flags on the first
block allocation.
---
Also tweaked gbmap repops during gc/traversals to _not_ try to repop
unless LFS3_I_REPOPGBMAP is set. We probably should have done this from
the beginning since repopulating the gbmap writes to disk and is
potentially destructive.
Adds code, though hopefully we can claw this back with future config
rework:
code stack ctx
before: 37176 2352 684
after: 37208 (+0.1%) 2352 (+0.0%) 688 (+0.6%)
code stack ctx
gbmap before: 40024 2368 848
gbmap after: 40120 (+0.2%) 2368 (+0.0%) 856 (+0.9%)
This commit is contained in:
+44
-39
@@ -103,29 +103,32 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
// a few preconfigured defines that control how benches run
|
||||
#define BENCH_IMPLICIT_DEFINES \
|
||||
/* name value (overridable) */ \
|
||||
BENCH_DEFINE(READ_SIZE, 1 ) \
|
||||
BENCH_DEFINE(PROG_SIZE, 1 ) \
|
||||
BENCH_DEFINE(BLOCK_SIZE, 4096 ) \
|
||||
BENCH_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
|
||||
BENCH_DEFINE(DISK_SIZE, 1024*1024 ) \
|
||||
BENCH_DEFINE(BLOCK_RECYCLES, -1 ) \
|
||||
BENCH_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
|
||||
BENCH_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
||||
BENCH_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
||||
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||
BENCH_DEFINE(GC_FLAGS, LFS3_GC_ALL ) \
|
||||
BENCH_DEFINE(GC_STEPS, 0 ) \
|
||||
BENCH_DEFINE(GC_COMPACTMETA_THRESH, 0 ) \
|
||||
BENCH_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
|
||||
BENCH_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||
BENCH_DEFINE(GBMAP_REPOP_THRESH, BLOCK_COUNT/4 ) \
|
||||
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
|
||||
BENCH_DEFINE(ERASE_CYCLES, 0 ) \
|
||||
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
||||
BENCH_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
|
||||
BENCH_DEFINE(EMUBD_SEED, 0 )
|
||||
/* name value (overridable) */ \
|
||||
BENCH_DEFINE(READ_SIZE, 1 ) \
|
||||
BENCH_DEFINE(PROG_SIZE, 1 ) \
|
||||
BENCH_DEFINE(BLOCK_SIZE, 4096 ) \
|
||||
BENCH_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
|
||||
BENCH_DEFINE(DISK_SIZE, 1024*1024 ) \
|
||||
BENCH_DEFINE(BLOCK_RECYCLES, -1 ) \
|
||||
BENCH_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
|
||||
BENCH_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
|
||||
BENCH_DEFINE(FILE_CACHE_SIZE, 16 ) \
|
||||
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||
BENCH_DEFINE(GC_FLAGS, LFS3_GC_ALL ) \
|
||||
BENCH_DEFINE(GC_STEPS, 0 ) \
|
||||
BENCH_DEFINE(GC_REPOPLOOKAHEAD_THRESH, \
|
||||
-1 ) \
|
||||
BENCH_DEFINE(GC_REPOPGBMAP_THRESH, -1 ) \
|
||||
BENCH_DEFINE(GC_COMPACTMETA_THRESH, 0 ) \
|
||||
BENCH_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
|
||||
BENCH_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||
BENCH_DEFINE(GBMAP_REPOP_THRESH, BLOCK_COUNT/4 ) \
|
||||
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
|
||||
BENCH_DEFINE(ERASE_CYCLES, 0 ) \
|
||||
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
|
||||
BENCH_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
|
||||
BENCH_DEFINE(EMUBD_SEED, 0 )
|
||||
|
||||
// declare defines as global intmax_ts
|
||||
#define BENCH_DEFINE(k, v) \
|
||||
@@ -136,25 +139,27 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
// map defines to cfg struct fields
|
||||
#define BENCH_CFG \
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
BENCH_GBMAP_CFG \
|
||||
BENCH_GC_CFG \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
BENCH_GBMAP_CFG \
|
||||
BENCH_GC_CFG \
|
||||
.gc_repoplookahead_thresh = GC_REPOPLOOKAHEAD_THRESH, \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
|
||||
#ifdef LFS3_GBMAP
|
||||
#define BENCH_GBMAP_CFG \
|
||||
.gbmap_repop_thresh = GBMAP_REPOP_THRESH,
|
||||
.gc_repopgbmap_thresh = GC_REPOPGBMAP_THRESH, \
|
||||
.gbmap_repop_thresh = GBMAP_REPOP_THRESH,
|
||||
#else
|
||||
#define BENCH_GBMAP_CFG
|
||||
#endif
|
||||
|
||||
+28
-23
@@ -107,6 +107,9 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
TEST_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||
TEST_DEFINE(GC_FLAGS, LFS3_GC_ALL ) \
|
||||
TEST_DEFINE(GC_STEPS, 0 ) \
|
||||
TEST_DEFINE(GC_REPOPLOOKAHEAD_THRESH, \
|
||||
-1 ) \
|
||||
TEST_DEFINE(GC_REPOPGBMAP_THRESH, -1 ) \
|
||||
TEST_DEFINE(GC_COMPACTMETA_THRESH, 0 ) \
|
||||
TEST_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
|
||||
TEST_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||
@@ -127,43 +130,45 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
// map defines to cfg struct fields
|
||||
#define TEST_CFG \
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
TEST_GBMAP_CFG \
|
||||
TEST_GC_CFG \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
TEST_GBMAP_CFG \
|
||||
TEST_GC_CFG \
|
||||
.gc_repoplookahead_thresh = GC_REPOPLOOKAHEAD_THRESH, \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
|
||||
#ifdef LFS3_GBMAP
|
||||
#define TEST_GBMAP_CFG \
|
||||
.gbmap_repop_thresh = GBMAP_REPOP_THRESH,
|
||||
.gc_repopgbmap_thresh = GC_REPOPGBMAP_THRESH, \
|
||||
.gbmap_repop_thresh = GBMAP_REPOP_THRESH,
|
||||
#else
|
||||
#define TEST_GBMAP_CFG
|
||||
#endif
|
||||
|
||||
#ifdef LFS3_GC
|
||||
#define TEST_GC_CFG \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS,
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS,
|
||||
#else
|
||||
#define TEST_GC_CFG
|
||||
#endif
|
||||
|
||||
#define TEST_BDCFG \
|
||||
.erase_value = ERASE_VALUE, \
|
||||
.erase_cycles = ERASE_CYCLES, \
|
||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||
.seed = EMUBD_SEED,
|
||||
.erase_value = ERASE_VALUE, \
|
||||
.erase_cycles = ERASE_CYCLES, \
|
||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||
.seed = EMUBD_SEED,
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user