Skip to content

Commit c4560c2

Browse files
Lai Jiangshanhtejun
authored andcommitted
workqueue: Change arguement of pwq_dec_nr_in_flight()
Make pwq_dec_nr_in_flight() use work_data rather just work_color. Prepare for later patch to get WORK_STRUCT_INACTIVE bit from work_data in pwq_dec_nr_in_flight(). No functional change intended. Signed-off-by: Lai Jiangshan <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent f97a4a1 commit c4560c2

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

kernel/workqueue.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,9 @@ static unsigned int work_color_to_flags(int color)
579579
return color << WORK_STRUCT_COLOR_SHIFT;
580580
}
581581

582-
static int get_work_color(struct work_struct *work)
582+
static int get_work_color(unsigned long work_data)
583583
{
584-
return (*work_data_bits(work) >> WORK_STRUCT_COLOR_SHIFT) &
584+
return (work_data >> WORK_STRUCT_COLOR_SHIFT) &
585585
((1 << WORK_STRUCT_COLOR_BITS) - 1);
586586
}
587587

@@ -1159,16 +1159,18 @@ static void pwq_activate_first_inactive(struct pool_workqueue *pwq)
11591159
/**
11601160
* pwq_dec_nr_in_flight - decrement pwq's nr_in_flight
11611161
* @pwq: pwq of interest
1162-
* @color: color of work which left the queue
1162+
* @work_data: work_data of work which left the queue
11631163
*
11641164
* A work either has completed or is removed from pending queue,
11651165
* decrement nr_in_flight of its pwq and handle workqueue flushing.
11661166
*
11671167
* CONTEXT:
11681168
* raw_spin_lock_irq(pool->lock).
11691169
*/
1170-
static void pwq_dec_nr_in_flight(struct pool_workqueue *pwq, int color)
1170+
static void pwq_dec_nr_in_flight(struct pool_workqueue *pwq, unsigned long work_data)
11711171
{
1172+
int color = get_work_color(work_data);
1173+
11721174
/* uncolored work items don't participate in flushing or nr_active */
11731175
if (color == WORK_NO_COLOR)
11741176
goto out_put;
@@ -1291,7 +1293,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
12911293
pwq_activate_inactive_work(work);
12921294

12931295
list_del_init(&work->entry);
1294-
pwq_dec_nr_in_flight(pwq, get_work_color(work));
1296+
pwq_dec_nr_in_flight(pwq, *work_data_bits(work));
12951297

12961298
/* work->data points to pwq iff queued, point to pool */
12971299
set_work_pool_and_keep_pending(work, pool->id);
@@ -2172,7 +2174,7 @@ __acquires(&pool->lock)
21722174
struct pool_workqueue *pwq = get_work_pwq(work);
21732175
struct worker_pool *pool = worker->pool;
21742176
bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE;
2175-
int work_color;
2177+
unsigned long work_data;
21762178
struct worker *collision;
21772179
#ifdef CONFIG_LOCKDEP
21782180
/*
@@ -2208,7 +2210,7 @@ __acquires(&pool->lock)
22082210
worker->current_work = work;
22092211
worker->current_func = work->func;
22102212
worker->current_pwq = pwq;
2211-
work_color = get_work_color(work);
2213+
work_data = *work_data_bits(work);
22122214

22132215
/*
22142216
* Record wq name for cmdline and debug reporting, may get
@@ -2314,7 +2316,7 @@ __acquires(&pool->lock)
23142316
worker->current_work = NULL;
23152317
worker->current_func = NULL;
23162318
worker->current_pwq = NULL;
2317-
pwq_dec_nr_in_flight(pwq, work_color);
2319+
pwq_dec_nr_in_flight(pwq, work_data);
23182320
}
23192321

23202322
/**

0 commit comments

Comments
 (0)