summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-02-28 15:23:48 +0100
committerMaria Matejka <mq@ucw.cz>2023-04-04 17:00:59 +0200
commitd16321686eeda23eed53fa83d40099c2607c5c2c (patch)
tree2883ec351330353b6d8ea9cd0f65f2ccd304247a /sysdep
parentb8d0ba36e6a64518ac078139c24a7a01002dce21 (diff)
Misc allocator fixes
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/unix/alloc.c4
-rw-r--r--sysdep/unix/main.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c
index 8bd3770d..cafcc8dd 100644
--- a/sysdep/unix/alloc.c
+++ b/sysdep/unix/alloc.c
@@ -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;
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 1ed57a99..ab076af6 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -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();