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
2659 struct wq_barrier *barr,2659 struct wq_barrier *barr,
2660 struct work_struct *target, struct worker *worker)2660 struct work_struct *target, struct worker *worker)
2661{2661{
2662 unsigned int work_flags = work_color_to_flags(WORK_NO_COLOR);
2662 struct list_head *head;2663 struct list_head *head;
2663 unsigned int linked = 0;
2664 2664
2665 /*2665 /*
2666 * debugobject calls are safe here even with pool->lock locked2666 * 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
2686 2686
2687 head = target->entry.next;2687 head = target->entry.next;
2688 /* there can already be other linked works, inherit and set */2688 /* there can already be other linked works, inherit and set */
2689 linked = *bits & WORK_STRUCT_LINKED;2689 work_flags |= *bits & WORK_STRUCT_LINKED;
2690 __set_bit(WORK_STRUCT_LINKED_BIT, bits);2690 __set_bit(WORK_STRUCT_LINKED_BIT, bits);
2691 }2691 }
2692 2692
2693 debug_work_activate(&barr->work);2693 debug_work_activate(&barr->work);
2694 insert_work(pwq, &barr->work, head,2694 insert_work(pwq, &barr->work, head, work_flags);
2695 work_color_to_flags(WORK_NO_COLOR) | linked);
2696}2695}
2697 2696
2698/**2697/**