History

workqueue: reimplement work flushing using linked works

A work is linked to the next one by having WORK_STRUCT_LINKED bit set and these links can be chained. When a linked work is dispatched to a worker, all linked works are dispatched to the worker's newly added ->scheduled queue and processed back-to-back. Currently, as there's only single worker per cwq, having linked works doesn't make any visible behavior difference. This change is to prepare for multiple shared workers per cpu.

Tejun Heo committed 16 years ago

Commit affee4b1 parent c34056a2 files · +134 −22Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/workqueue.h+3−1
@@ -24,8 +24,9 @@ typedef void (*work_func_t)(struct work_struct *work); · 23 unmodified lines
2424
2525 enum {
2626 WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */
27+ WORK_STRUCT_LINKED_BIT = 1, /* next work is linked to this one */
2728 #ifdef CONFIG_DEBUG_OBJECTS_WORK
28− WORK_STRUCT_STATIC_BIT = 1, /* static initializer (debugobjects) */
29+ WORK_STRUCT_STATIC_BIT = 2, /* static initializer (debugobjects) */
2930 WORK_STRUCT_COLOR_SHIFT = 3, /* color for workqueue flushing */
3031 #else
3132 WORK_STRUCT_COLOR_SHIFT = 2, /* color for workqueue flushing */
@@ -34,6 +35,7 @@ enum { · 2 unmodified lines
3435 WORK_STRUCT_COLOR_BITS = 4,
3536
3637 WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT,
38+ WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT,
3739 #ifdef CONFIG_DEBUG_OBJECTS_WORK
3840 WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT,
3941 #else