Skip to content

Commit 9a9bdfd

Browse files
Sebastian Andrzej SiewiorPeter Zijlstra
authored andcommitted
futex: Create helper function to initialize a hash slot
Factor out the futex_hash_bucket initialisation into a helpr function. The helper function will be used in a follow up patch implementing process private hash buckets. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b04b8f3 commit 9a9bdfd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

kernel/futex/core.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,13 @@ void futex_exit_release(struct task_struct *tsk)
11601160
futex_cleanup_end(tsk, FUTEX_STATE_DEAD);
11611161
}
11621162

1163+
static void futex_hash_bucket_init(struct futex_hash_bucket *fhb)
1164+
{
1165+
atomic_set(&fhb->waiters, 0);
1166+
plist_head_init(&fhb->chain);
1167+
spin_lock_init(&fhb->lock);
1168+
}
1169+
11631170
static int __init futex_init(void)
11641171
{
11651172
unsigned long hashsize, i;
@@ -1177,11 +1184,8 @@ static int __init futex_init(void)
11771184
hashsize, hashsize);
11781185
hashsize = 1UL << futex_shift;
11791186

1180-
for (i = 0; i < hashsize; i++) {
1181-
atomic_set(&futex_queues[i].waiters, 0);
1182-
plist_head_init(&futex_queues[i].chain);
1183-
spin_lock_init(&futex_queues[i].lock);
1184-
}
1187+
for (i = 0; i < hashsize; i++)
1188+
futex_hash_bucket_init(&futex_queues[i]);
11851189

11861190
futex_hashmask = hashsize - 1;
11871191
return 0;

0 commit comments

Comments
 (0)