Raise dsk alloc priority of logbuffer flushes with frees

Hopefully, this also contributes to a solution for #28
parent 91538632
......@@ -2198,11 +2198,23 @@ log_blocks_alloc_from_reqs(struct buddy_reqs *reqs,
}
static void
logbuffer_fill_dskreq(struct buddy_reqs *reqs) {
logbuffer_fill_dskreq(const struct fellow_logbuffer *lbuf,
struct buddy_reqs *reqs) {
unsigned i;
uint8_t pri;
CHECK_OBJ_NOTNULL(lbuf, FELLOW_LOGBUFFER_MAGIC);
CHECK_OBJ_NOTNULL(reqs, BUDDY_REQS_MAGIC);
buddy_alloc_wait_done(reqs);
if (lbuf->regions_to_free &&
regionlist_used(lbuf->regions_to_free))
pri = FEP_DSK_LOG_PRI;
else
pri = FEP_DSK_LOG;
BUDDY_REQS_PRI(reqs, pri);
for (i = 0; i < reqs->space; i++)
AN(buddy_req_page(reqs, MIN_FELLOW_BITS, 0));
(void) buddy_alloc_async(reqs);
......@@ -2228,7 +2240,7 @@ logbuffer_get_dskreqs(struct fellow_logbuffer *lbuf)
(void) buddy_alloc_async_wait(reqs);
if (buddy_reqs_next_ready(reqs))
return (reqs); // ret2
logbuffer_fill_dskreq(reqs);
logbuffer_fill_dskreq(lbuf, reqs);
lbuf->active_reqs = ! lbuf->active_reqs;
}
......@@ -2252,6 +2264,8 @@ logbuffer_alloc_some(struct fellow_logbuffer *lbuf,
AN(arr);
AN(n);
assert(logbuffer_can(lbuf, LBUF_CAN_FLUSH));
if (lbuf->logreg != NULL)
i = logblocks_alloc_from_logregion(lbuf->logreg, arr, n);
else
......@@ -2299,8 +2313,7 @@ logbuffer_alloc_some(struct fellow_logbuffer *lbuf,
dskreqs = alloc.ptr;
for (i = 0; i < 2; i++) {
BUDDY_REQS_INIT(&(*dskreqs)[i], lbuf->dskbuddy);
BUDDY_REQS_PRI(&(*dskreqs)[i].reqs, FEP_DSK_LOG);
logbuffer_fill_dskreq(&(*dskreqs)[i].reqs);
logbuffer_fill_dskreq(lbuf, &(*dskreqs)[i].reqs);
}
lbuf->dskreqs = dskreqs;
}
......
......@@ -37,3 +37,4 @@
#define FEP_ITER 4 // obj critical (oh lck)
#define FEP_MEM_FREE 4 // regionlist
#define FEP_DSK_LOG 4 // logbuffer_alloc_some
#define FEP_DSK_LOG_PRI 5 // logbuffer_alloc_... free
......@@ -182,6 +182,18 @@ regionlist_alloc(buddy_t *membuddy)
return (rl);
}
static unsigned
regionlist_used(const struct regionlist *rl)
{
struct regl *r;
CHECK_OBJ_NOTNULL(rl, REGIONLIST_MAGIC);
r = VSTAILQ_FIRST(&rl->head);
if (r == NULL)
return (0);
return (r->n);
}
static void
regionlist_append(struct regionlist *to, struct regionlist **fromp)
{
......
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