From e96c44e32d0b95eecdff9db344617fd24027eeba Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Thu, 27 Jun 2024 09:08:01 +0200 Subject: [PATCH] fixup! Forbid locking altogether when RCU reader is active --- sysdep/unix/alloc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 1cf41a5b..0432b9e2 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);