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.

locking/osq_lock: Clarify osq_wait_next()

Directly return NULL or 'next' instead of breaking out of the loop.

Signed-off-by: David Laight <david.laight@aculab.com>
[ Split original patch into two independent parts - Linus ]
Link: https://lore.kernel.org/lkml/7c8828aec72e42eeb841ca0ee3397e9a@AcuMS.aculab.com/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Laight and committed by
Linus Torvalds
b106bcf0 563adbfc

+4 -5
+4 -5
kernel/locking/osq_lock.c
··· 55 55 struct optimistic_spin_node *node, 56 56 int old_cpu) 57 57 { 58 - struct optimistic_spin_node *next = NULL; 59 58 int curr = encode_cpu(smp_processor_id()); 60 59 61 60 for (;;) { ··· 65 66 * will now observe @lock and will complete its 66 67 * unlock()/unqueue(). 67 68 */ 68 - break; 69 + return NULL; 69 70 } 70 71 71 72 /* ··· 79 80 * wait for a new @node->next from its Step-C. 80 81 */ 81 82 if (node->next) { 83 + struct optimistic_spin_node *next; 84 + 82 85 next = xchg(&node->next, NULL); 83 86 if (next) 84 - break; 87 + return next; 85 88 } 86 89 87 90 cpu_relax(); 88 91 } 89 - 90 - return next; 91 92 } 92 93 93 94 bool osq_lock(struct optimistic_spin_queue *lock)