From 8e67cba5281c18f40d7f1505c845703c0d82f478 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Tue, 25 Jun 2024 14:02:15 +0200 Subject: [PATCH] Linpool: allocation split to fast and slow --- lib/mempool.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/mempool.c b/lib/mempool.c index ce513cfc5..5940e5712 100644 --- a/lib/mempool.c +++ b/lib/mempool.c @@ -43,6 +43,7 @@ struct linpool { uint total, total_large; }; +static void *lp_alloc_slow(struct linpool *, uint); static void lp_free(resource *); static void lp_dump(resource *, unsigned); static resource *lp_lookup(resource *, unsigned long); @@ -99,6 +100,11 @@ lp_alloc(linpool *m, uint size) return a; } else + return lp_alloc_slow(m, size); +} + +static void * +lp_alloc_slow(linpool *m, uint size) { struct lp_chunk *c; if (size > LP_DATA_SIZE) @@ -134,7 +140,6 @@ lp_alloc(linpool *m, uint size) } return c->data; } -} /** * lp_allocu - allocate unaligned memory from a &linpool @@ -158,7 +163,7 @@ lp_allocu(linpool *m, uint size) m->ptr = e; return a; } - return lp_alloc(m, size); + return lp_alloc_slow(m, size); } /** -- 2.47.2