0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Misc allocator fixes

This commit is contained in:
Maria Matejka 2023-02-28 15:23:48 +01:00
parent b8d0ba36e6
commit d16321686e
2 changed files with 6 additions and 0 deletions

View File

@ -118,6 +118,8 @@ alloc_page(void)
return fp;
}
ASSERT_DIE(pages_kept_here == 0);
/* If there is any free page kept hot in global storage, we use it. */
rcu_read_lock();
fp = atomic_load_explicit(&page_stack, memory_order_acquire);
@ -176,6 +178,8 @@ free_page(void *ptr)
if (shutting_down || (pages_kept_here < KEEP_PAGES_MAX_LOCAL))
{
atomic_store_explicit(&fp->next, local_page_stack, memory_order_relaxed);
local_page_stack = fp;
atomic_fetch_add_explicit(&pages_kept_locally, 1, memory_order_relaxed);
pages_kept_here++;
return;

View File

@ -935,6 +935,8 @@ main(int argc, char **argv)
if (parse_and_exit)
exit(0);
flush_local_pages();
if (!run_in_foreground)
{
pid_t pid = fork();