From: Maria Matejka Date: Thu, 27 Jun 2024 07:08:01 +0000 (+0200) Subject: fixup! Forbid locking altogether when RCU reader is active X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e96c44e32d0b95eecdff9db344617fd24027eeba;p=thirdparty%2Fbird.git fixup! Forbid locking altogether when RCU reader is active --- diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 1cf41a5bb..0432b9e26 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -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);