Split crystal_thresh into crystal_thresh + fragment_thresh

So now crystal_thresh only controls when fragments are compacted into
blocks, while fragment_thresh controls when blocks are broken into
fragments. Setting fragment_thresh=-1 will follow crystal_thresh and
keeps the previous behavior.

These were already two separate pieces of logic, so it makes sense to
provide two separate knobs for tuning.

Setting fragment_thresh lower than crystal_thresh has some potential to
reduce hysteresis in cases where random writes push blocks close to
crystal_thresh. It will be interesting to explore this more when
benchmarking.

---

The additional config option adds a bit of code/ctx, but hopefully that
will go away in the future config rework:

           code          stack          ctx
  before: 35584           2480          636
  after:  35600 (+0.0%)   2480 (+0.0%)  640 (+0.6%)
This commit is contained in:
Christopher Haster
2025-04-18 15:43:38 -05:00
parent 200830aafe
commit c5efe35ab2
5 changed files with 37 additions and 10 deletions
+3 -1
View File
@@ -120,6 +120,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
BENCH_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
BENCH_DEFINE(FRAGMENT_SIZE, BLOCK_SIZE/8 ) \
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
BENCH_DEFINE(FRAGMENT_THRESH, -1 ) \
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
BENCH_DEFINE(ERASE_CYCLES, 0 ) \
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS_EMUBD_BADBLOCK_PROGERROR ) \
@@ -148,7 +149,8 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
.gc_compact_thresh = GC_COMPACT_THRESH, \
.inline_size = INLINE_SIZE, \
.fragment_size = FRAGMENT_SIZE, \
.crystal_thresh = CRYSTAL_THRESH,
.crystal_thresh = CRYSTAL_THRESH, \
.fragment_thresh = FRAGMENT_THRESH,
#ifdef LFS_GC
#define BENCH_GC_CFG \
+3 -1
View File
@@ -111,6 +111,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
TEST_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
TEST_DEFINE(FRAGMENT_SIZE, BLOCK_SIZE/8 ) \
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
TEST_DEFINE(FRAGMENT_THRESH, -1 ) \
TEST_DEFINE(ERASE_VALUE, 0xff ) \
TEST_DEFINE(ERASE_CYCLES, 0 ) \
TEST_DEFINE(BADBLOCK_BEHAVIOR, LFS_EMUBD_BADBLOCK_PROGERROR ) \
@@ -139,7 +140,8 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
.gc_compact_thresh = GC_COMPACT_THRESH, \
.inline_size = INLINE_SIZE, \
.fragment_size = FRAGMENT_SIZE, \
.crystal_thresh = CRYSTAL_THRESH
.crystal_thresh = CRYSTAL_THRESH, \
.fragment_thresh = FRAGMENT_THRESH,
#ifdef LFS_GC
#define TEST_GC_CFG \