History

workqueue: Change the code of calculating work_flags in insert_wq_barrier()

Add a local var @work_flags to calculate work_flags step by step, so that we don't need to squeeze several flags in only the last line of code. Parepare for next patch to add a bit to barrier work item's flag. Not squshing this to next patch makes it clear that what it will have changed. No functional change intended.

Lai Jiangshan committed 5 years ago

Commit d21cece1 parent c4560c21 file · +3 −4Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+3−4
@@ -2659,8 +2659,8 @@ static void insert_wq_barrier(struct pool_workqueue *pwq, · 2658 unmodified lines
26592659 struct wq_barrier *barr,
26602660 struct work_struct *target, struct worker *worker)
26612661 {
2662+ unsigned int work_flags = work_color_to_flags(WORK_NO_COLOR);
26622663 struct list_head *head;
2663− unsigned int linked = 0;
26642664
26652665 /*
26662666 * debugobject calls are safe here even with pool->lock locked
@@ -2686,13 +2686,12 @@ static void insert_wq_barrier(struct pool_workqueue *pwq, · 19 unmodified lines
26862686
26872687 head = target->entry.next;
26882688 /* there can already be other linked works, inherit and set */
2689− linked = *bits & WORK_STRUCT_LINKED;
2689+ work_flags |= *bits & WORK_STRUCT_LINKED;
26902690 __set_bit(WORK_STRUCT_LINKED_BIT, bits);
26912691 }
26922692
26932693 debug_work_activate(&barr->work);
2694− insert_work(pwq, &barr->work, head,
2695− work_color_to_flags(WORK_NO_COLOR) | linked);
2694+ insert_work(pwq, &barr->work, head, work_flags);
26962695 }
26972696
26982697 /**