aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/kernel/futex/core.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2025-04-16 18:29:13 +0200
committerPeter Zijlstra <peterz@infradead.org>2025-05-03 12:02:08 +0200
commit7c4f75a21f636486d2969d9b6680403ea8483539 (patch)
tree7ba61bc8ba91244f8180bcd17e7f54679fe9e0aa /kernel/futex/core.c
parentfutex: Add basic infrastructure for local task local hash (diff)
downloadwireguard-linux-7c4f75a21f636486d2969d9b6680403ea8483539.tar.xz
wireguard-linux-7c4f75a21f636486d2969d9b6680403ea8483539.zip
futex: Allow automatic allocation of process wide futex hash
Allocate a private futex hash with 16 slots if a task forks its first thread. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250416162921.513656-14-bigeasy@linutronix.de
Diffstat (limited to '')
-rw-r--r--kernel/futex/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 818df7420a1a..53b3a00a9253 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1294,6 +1294,17 @@ static int futex_hash_allocate(unsigned int hash_slots, bool custom)
return 0;
}
+int futex_hash_allocate_default(void)
+{
+ if (!current->mm)
+ return 0;
+
+ if (current->mm->futex_phash)
+ return 0;
+
+ return futex_hash_allocate(16, false);
+}
+
static int futex_hash_get_slots(void)
{
struct futex_private_hash *fph;