Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250416162921.513656-12-bigeasy@linutronix.de

authored by

Sebastian Andrzej Siewior and committed by
Peter Zijlstra
9a9bdfdd b04b8f30

+9 -5
+9 -5
kernel/futex/core.c
··· 1160 1160 futex_cleanup_end(tsk, FUTEX_STATE_DEAD); 1161 1161 } 1162 1162 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 + 1163 1170 static int __init futex_init(void) 1164 1171 { 1165 1172 unsigned long hashsize, i; ··· 1184 1177 hashsize, hashsize); 1185 1178 hashsize = 1UL << futex_shift; 1186 1179 1187 - for (i = 0; i < hashsize; i++) { 1188 - atomic_set(&futex_queues[i].waiters, 0); 1189 - plist_head_init(&futex_queues[i].chain); 1190 - spin_lock_init(&futex_queues[i].lock); 1191 - } 1180 + for (i = 0; i < hashsize; i++) 1181 + futex_hash_bucket_init(&futex_queues[i]); 1192 1182 1193 1183 futex_hashmask = hashsize - 1; 1194 1184 return 0;