alloc: Merged LOOKAHEAD+LOOKGBMAP -> single LOOKAHEAD flag
Our flag space is already really packed, and I'm not sure having these
as separate flags is meaningful or useful for users. They both indicate
to repopulate allocators, and most users probably won't care that there
are two subtly different allocators operating under the hood.
There's an argument that LOOKAHEAD not touching disk is a useful
distinction, but in practice you really only need LOOKAHEAD work when
mounted RDWR.
So, merged the behaviors of LOOKAHEAD + LOOKGBMAP such that
LFS3_*_LOOKAHEAD requests repopulation of all allocators based on
gc_lookahead_thresh and gc_lookgbmap_thresh.
In priority order (some notes below):
1. If max(lookahead, gbmap) < gc_lookahead_thresh => repop lookahead
2. If gbmap < gc_lookgbmap_thresh => repop gbmap
As a plus, this makes it easier to avoid LFS3_IFDEF_GBMAP mess.
---
It's interesting to note LFS3_*_LOOKAHEAD will still repopulate the
lookahead buffer when the gbmap is present, but only if this would gain
more knowledge than was is currently in the gbmap.
I considered disabling lookahead scans completely when we have a gbmap,
but repopulating the lookahead buffer is still useful if the gbmap is at
risk of exhaustion. This is what gc_lookahead_thresh is for anyways, and
users can set gc_lookahead_thresh=0 if they want to disable this
behavior.
Relatedly, lookahead scans are actually prioritized over gbmap scans
(when they would gain knowledge). In theory this minimizes gc latency,
as gbmap scans risk triggering a full lookahead scan when building the
new gbmap.
---
Code changes minimal:
code stack ctx
before: 35152 2136 660
after: 35152 (+0.0%) 2136 (+0.0%) 660 (+0.0%)
code stack ctx
gbmap before: 38076 2136 776
gbmap after: 38080 (+0.0%) 2136 (+0.0%) 776 (+0.0%)
This commit is contained in:
@@ -206,11 +206,7 @@ enum lfs3_type {
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_F_LOOKAHEAD \
|
||||
0x00001000 // Repopulate lookahead buffer
|
||||
#endif
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP)
|
||||
#define LFS3_F_LOOKGBMAP \
|
||||
0x00002000 // Repopulate the gbmap
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_F_COMPACTMETA \
|
||||
@@ -258,11 +254,7 @@ enum lfs3_type {
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_M_LOOKAHEAD \
|
||||
0x00001000 // Repopulate lookahead buffer
|
||||
#endif
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP)
|
||||
#define LFS3_M_LOOKGBMAP \
|
||||
0x00002000 // Repopulate the gbmap
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_M_COMPACTMETA \
|
||||
@@ -305,11 +297,7 @@ enum lfs3_type {
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_I_LOOKAHEAD \
|
||||
0x00001000 // Lookahead buffer is not full
|
||||
#endif
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP)
|
||||
#define LFS3_I_LOOKGBMAP \
|
||||
0x00002000 // The gbmap is not full
|
||||
0x00001000 // Lookahead/gbmap is not full
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_I_COMPACTMETA \
|
||||
@@ -340,11 +328,7 @@ enum lfs3_btype {
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_T_LOOKAHEAD \
|
||||
0x00001000 // Repopulate lookahead buffer
|
||||
#endif
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP)
|
||||
#define LFS3_T_LOOKGBMAP \
|
||||
0x00002000 // Repopulate the gbmap
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_T_COMPACTMETA \
|
||||
@@ -369,11 +353,7 @@ enum lfs3_btype {
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_CK_LOOKAHEAD \
|
||||
0x00001000 // Repopulate lookahead buffer
|
||||
#endif
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP)
|
||||
#define LFS3_CK_LOOKGBMAP \
|
||||
0x00002000 // Repopulate the gbmap
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_CK_COMPACTMETA \
|
||||
@@ -389,11 +369,7 @@ enum lfs3_btype {
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_GC_LOOKAHEAD \
|
||||
0x00001000 // Repopulate lookahead buffer
|
||||
#endif
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP)
|
||||
#define LFS3_GC_LOOKGBMAP \
|
||||
0x00002000 // Repopulate the gbmap
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_GC_COMPACTMETA \
|
||||
@@ -406,8 +382,6 @@ enum lfs3_btype {
|
||||
#define LFS3_GC_ALL ( \
|
||||
LFS3_IFDEF_RDONLY(0, LFS3_GC_MKCONSISTENT) \
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_GC_LOOKAHEAD) \
|
||||
| LFS3_IFDEF_RDONLY(0, \
|
||||
LFS3_IFDEF_GBMAP(LFS3_GC_LOOKGBMAP, 0)) \
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_GC_COMPACTMETA) \
|
||||
| LFS3_GC_CKMETA \
|
||||
| LFS3_GC_CKDATA)
|
||||
|
||||
Reference in New Issue
Block a user