]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
workqueue: Change the code of calculating work_flags in insert_wq_barrier()
authorLai Jiangshan <laijs@linux.alibaba.com>
Tue, 17 Aug 2021 01:32:36 +0000 (09:32 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 17 Aug 2021 17:49:10 +0000 (07:49 -1000)
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 <laijs@linux.alibaba.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index 41796000f3eb2978b52a096a8eecd49305e6dcf2..84fd2a8f56aac6e897c6d1ab19866de353bf14d9 100644 (file)
@@ -2659,8 +2659,8 @@ static void insert_wq_barrier(struct pool_workqueue *pwq,
                              struct wq_barrier *barr,
                              struct work_struct *target, struct worker *worker)
 {
+       unsigned int work_flags = work_color_to_flags(WORK_NO_COLOR);
        struct list_head *head;
-       unsigned int linked = 0;
 
        /*
         * debugobject calls are safe here even with pool->lock locked
@@ -2686,13 +2686,12 @@ static void insert_wq_barrier(struct pool_workqueue *pwq,
 
                head = target->entry.next;
                /* there can already be other linked works, inherit and set */
-               linked = *bits & WORK_STRUCT_LINKED;
+               work_flags |= *bits & WORK_STRUCT_LINKED;
                __set_bit(WORK_STRUCT_LINKED_BIT, bits);
        }
 
        debug_work_activate(&barr->work);
-       insert_work(pwq, &barr->work, head,
-                   work_color_to_flags(WORK_NO_COLOR) | linked);
+       insert_work(pwq, &barr->work, head, work_flags);
 }
 
 /**