]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
fixup! Forbid locking altogether when RCU reader is active
authorMaria Matejka <mq@ucw.cz>
Thu, 27 Jun 2024 07:08:01 +0000 (09:08 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 27 Jun 2024 07:08:01 +0000 (09:08 +0200)
sysdep/unix/alloc.c

index 1cf41a5bb78e2f8919b9f6047d565bdf210feb5c..0432b9e265113546804ba6928cff41a9c69bada9 100644 (file)
@@ -215,6 +215,14 @@ alloc_page(void)
   /* Reinstate the stack with zero */
   PAGE_STACK_PUT(NULL);
 
+  if (rcu_read_active())
+  {
+    /* We can't lock and we actually shouldn't alloc either when rcu is active
+     * but that's a quest for another day. */
+  }
+  else
+  {
+
   /* If there is any free page kept cold, we use that. */
   LOCK_DOMAIN(resource, empty_pages_domain);
   if (empty_pages) {
@@ -244,6 +252,8 @@ alloc_page(void)
   if (fp)
     return fp;
 
+  }
+
   /* And in the worst case, allocate some new pages by mmap() */
   void *ptr = alloc_sys_page();
   ajlog(ptr, NULL, 0, AJT_ALLOC_MMAP);