fellow_busy: Add a mempool

Unfortunately, this brings us above 4K, so we fill up with io structs
parent 07f49056
...@@ -687,6 +687,11 @@ struct fellow_busy_io_seglist { ...@@ -687,6 +687,11 @@ struct fellow_busy_io_seglist {
struct buddy_off_extent reg; struct buddy_off_extent reg;
}; };
// pool for segment memory
BUDDY_POOL(fbo_segmem, 1);
//BUDDY_POOL_GET_FUNC(fbo_segmem, static)
//BUDDY_POOL_AVAIL_FUNC(fbo_segmem, static)
struct fellow_busy_io { struct fellow_busy_io {
uint16_t magic; uint16_t magic;
#define FELLOW_BUSY_IO_MAGIC 0x0bcb #define FELLOW_BUSY_IO_MAGIC 0x0bcb
...@@ -727,13 +732,15 @@ struct fellow_busy { ...@@ -727,13 +732,15 @@ struct fellow_busy {
struct fellow_cache_seg *body_seg; struct fellow_cache_seg *body_seg;
struct fellow_body_region body_region; struct fellow_body_region body_region;
struct fbo_segmem segmem[1];
#define FCO_MAX_REGIONS ((FELLOW_DISK_LOG_BLOCK_ENTRIES - 1) * DLE_REG_NREGION) #define FCO_MAX_REGIONS ((FELLOW_DISK_LOG_BLOCK_ENTRIES - 1) * DLE_REG_NREGION)
// for fdsl and busy region last chance // for fdsl and busy region last chance
#define FCO_REGIONS_RESERVE 3 #define FCO_REGIONS_RESERVE 3
struct buddy_off_extent region[FCO_MAX_REGIONS]; struct buddy_off_extent region[FCO_MAX_REGIONS];
unsigned nregion; unsigned nregion;
uint8_t grown; uint8_t grown;
#define FBO_NIO 11 #define FBO_NIO 100
/* protected by fco mtx */ /* protected by fco mtx */
uint8_t io_idx; uint8_t io_idx;
uint8_t io_outstanding; uint8_t io_outstanding;
...@@ -2014,6 +2021,21 @@ fellow_cache_obj_new( ...@@ -2014,6 +2021,21 @@ fellow_cache_obj_new(
return (fcr); return (fcr);
} }
static void
fellow_busy_fill_segmem(struct buddy_reqs *reqs, const void *priv)
{
const struct stvfe_tune *tune;
unsigned u, bits;
CHECK_OBJ_NOTNULL(reqs, BUDDY_REQS_MAGIC);
CAST_OBJ_NOTNULL(tune, priv, STVFE_TUNE_MAGIC);
bits = tune->chunk_exponent;
for (u = 0; u < reqs->space; u++)
AN(buddy_req_page(reqs, bits, 0));
}
struct fellow_cache_res struct fellow_cache_res
fellow_busy_obj_alloc(struct fellow_cache *fc, fellow_busy_obj_alloc(struct fellow_cache *fc,
struct fellow_cache_obj **fcop, uintptr_t *priv2, struct fellow_cache_obj **fcop, uintptr_t *priv2,
...@@ -2140,6 +2162,9 @@ fellow_busy_obj_alloc(struct fellow_cache *fc, ...@@ -2140,6 +2162,9 @@ fellow_busy_obj_alloc(struct fellow_cache *fc,
*/ */
fbo->io_outstanding = 1; fbo->io_outstanding = 1;
BUDDY_POOL_INIT(fbo->segmem, fc->membuddy, FEP_SPC,
fellow_busy_fill_segmem, fc->tune);
return (FCR_OK(fbo)); return (FCR_OK(fbo));
} }
...@@ -4723,6 +4748,8 @@ fellow_busy_done(struct fellow_busy *fbo, struct objcore *oc, unsigned inlog) ...@@ -4723,6 +4748,8 @@ fellow_busy_done(struct fellow_busy *fbo, struct objcore *oc, unsigned inlog)
fc = fbo->fc; fc = fbo->fc;
CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC); CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC);
BUDDY_POOL_FINI(fbo->segmem);
// nicer way? // nicer way?
if (fbo->body_seg != NULL) if (fbo->body_seg != NULL)
fellow_busy_obj_trimstore(fbo); fellow_busy_obj_trimstore(fbo);
...@@ -6562,7 +6589,7 @@ main(int argc, char **argv) ...@@ -6562,7 +6589,7 @@ main(int argc, char **argv)
fn = argv[1]; fn = argv[1];
DBG("fellow_busy %zu", sizeof(struct fellow_busy)); DBG("fellow_busy %zu", sizeof(struct fellow_busy));
assert(sizeof(struct fellow_busy) <= MIN_FELLOW_BLOCK); assert(sizeof(struct fellow_busy) <= 2 * MIN_FELLOW_BLOCK);
t_tailq_concat(); t_tailq_concat();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment