@@ -579,9 +579,9 @@ static unsigned int work_color_to_flags(int color)
579
579
return color << WORK_STRUCT_COLOR_SHIFT ;
580
580
}
581
581
582
- static int get_work_color (struct work_struct * work )
582
+ static int get_work_color (unsigned long work_data )
583
583
{
584
- return (* work_data_bits ( work ) >> WORK_STRUCT_COLOR_SHIFT ) &
584
+ return (work_data >> WORK_STRUCT_COLOR_SHIFT ) &
585
585
((1 << WORK_STRUCT_COLOR_BITS ) - 1 );
586
586
}
587
587
@@ -1159,16 +1159,18 @@ static void pwq_activate_first_inactive(struct pool_workqueue *pwq)
1159
1159
/**
1160
1160
* pwq_dec_nr_in_flight - decrement pwq's nr_in_flight
1161
1161
* @pwq: pwq of interest
1162
- * @color: color of work which left the queue
1162
+ * @work_data: work_data of work which left the queue
1163
1163
*
1164
1164
* A work either has completed or is removed from pending queue,
1165
1165
* decrement nr_in_flight of its pwq and handle workqueue flushing.
1166
1166
*
1167
1167
* CONTEXT:
1168
1168
* raw_spin_lock_irq(pool->lock).
1169
1169
*/
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 )
1171
1171
{
1172
+ int color = get_work_color (work_data );
1173
+
1172
1174
/* uncolored work items don't participate in flushing or nr_active */
1173
1175
if (color == WORK_NO_COLOR )
1174
1176
goto out_put ;
@@ -1291,7 +1293,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
1291
1293
pwq_activate_inactive_work (work );
1292
1294
1293
1295
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 ));
1295
1297
1296
1298
/* work->data points to pwq iff queued, point to pool */
1297
1299
set_work_pool_and_keep_pending (work , pool -> id );
@@ -2172,7 +2174,7 @@ __acquires(&pool->lock)
2172
2174
struct pool_workqueue * pwq = get_work_pwq (work );
2173
2175
struct worker_pool * pool = worker -> pool ;
2174
2176
bool cpu_intensive = pwq -> wq -> flags & WQ_CPU_INTENSIVE ;
2175
- int work_color ;
2177
+ unsigned long work_data ;
2176
2178
struct worker * collision ;
2177
2179
#ifdef CONFIG_LOCKDEP
2178
2180
/*
@@ -2208,7 +2210,7 @@ __acquires(&pool->lock)
2208
2210
worker -> current_work = work ;
2209
2211
worker -> current_func = work -> func ;
2210
2212
worker -> current_pwq = pwq ;
2211
- work_color = get_work_color (work );
2213
+ work_data = * work_data_bits (work );
2212
2214
2213
2215
/*
2214
2216
* Record wq name for cmdline and debug reporting, may get
@@ -2314,7 +2316,7 @@ __acquires(&pool->lock)
2314
2316
worker -> current_work = NULL ;
2315
2317
worker -> current_func = NULL ;
2316
2318
worker -> current_pwq = NULL ;
2317
- pwq_dec_nr_in_flight (pwq , work_color );
2319
+ pwq_dec_nr_in_flight (pwq , work_data );
2318
2320
}
2319
2321
2320
2322
/**
0 commit comments