Skip to content

Commit d21cece

Browse files
Lai Jiangshanhtejun
authored andcommitted
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. Signed-off-by: Lai Jiangshan <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent c4560c2 commit d21cece

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

kernel/workqueue.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,8 +2659,8 @@ static void insert_wq_barrier(struct pool_workqueue *pwq,
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,
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
/**

0 commit comments

Comments
 (0)