Skip to content

Commit 016190a

Browse files
isilenceIngo Molnar
authored andcommitted
sched/wait: Deduplicate code with do-while
Statements in the loop's body and before it are identical. Use do-while to not repeat it. Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/43ffea6ee2152b90dedf962eac851609e4197218.1560256112.git.asml.silence@gmail.com Signed-off-by: Ingo Molnar <[email protected]>
1 parent 8ec59c0 commit 016190a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

kernel/sched/wait.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,12 @@ static void __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int
118118
bookmark.func = NULL;
119119
INIT_LIST_HEAD(&bookmark.entry);
120120

121-
spin_lock_irqsave(&wq_head->lock, flags);
122-
nr_exclusive = __wake_up_common(wq_head, mode, nr_exclusive, wake_flags, key, &bookmark);
123-
spin_unlock_irqrestore(&wq_head->lock, flags);
124-
125-
while (bookmark.flags & WQ_FLAG_BOOKMARK) {
121+
do {
126122
spin_lock_irqsave(&wq_head->lock, flags);
127123
nr_exclusive = __wake_up_common(wq_head, mode, nr_exclusive,
128124
wake_flags, key, &bookmark);
129125
spin_unlock_irqrestore(&wq_head->lock, flags);
130-
}
126+
} while (bookmark.flags & WQ_FLAG_BOOKMARK);
131127
}
132128

133129
/**

0 commit comments

Comments
 (0)