0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 12:48:43 +00:00

Linpool: allocation split to fast and slow

This commit is contained in:
Maria Matejka 2024-06-25 14:02:15 +02:00
parent 3d45539455
commit 8e67cba528

View File

@ -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);
}
/**