arena: use the entire imported span The source arena will round up to its quantum. However, we would only know that we got 'import_size', but we might get far more than that from the parent. If we round-up in advance, we'll know how much we are getting. Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/src/arena.c b/kern/src/arena.c index 2c26ff3..267871f 100644 --- a/kern/src/arena.c +++ b/kern/src/arena.c
@@ -687,9 +687,14 @@ void *span; size_t import_size; - /* MAX check, in case size << scale overflows */ - import_size = MAX(size, size << arena->import_scale); if (arena->source) { + /* MAX check, in case size << scale overflows */ + import_size = MAX(size, size << arena->import_scale); + /* The source will roundup to the nearest quantum. We might as + * well do it now so that we know about the extra space. + * Otherwise we'd just waste the excess. */ + import_size = MAX(import_size, + ROUNDUP(import_size, arena->source->quantum)); span = arena->afunc(arena->source, import_size, flags); if (!span) return FALSE;