workqueue: fixes for v2.6.36-rc3
Subsystems (2)
Tejun Heo
maintainerHello, Linus.
Please pull from the following branch to receive workqueue fixes for v2.6.36-rc3.
git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-linus
The branch contains eight patches making the following changes.
* cwq->nr_active could underflow, which could lead to BUG_ON() triggering on workqueue destruction and other work scheduling oddities. The fix adds one bit to work struct flags enlarging the alignment requirement for cpu_workqueues to 256 bytes. This will be reduced again by dropping WORK_STRUCT_CWQ_BIT in the next merge window.
* GCWQ_DISASSOCIATED and gcwq->mayday_mask initializations were incorrect. This could make rescuers fall into infinite loops on CONFIG_CPUMASK_OFFSTACK=y configurations. CAI Qian verified the fix.
* As worklist is shared by multiple workqueues now, it's important that there's no work pending when a workqueue is being destroyed. Some workqueue users didn't do this and ended up triggering BUG_ON() during destroy_workqueue(), at which point it's not clear who caused the problem. WQ_DYING flag is added so that work queueing attempts after the final flush can be caught on queueing.
* Fix memory leak on destroy_workqueue().
* Sparse annotations and docbook update.
Thanks.
Jason Baron (1):
workqueue: Add a workqueue chapter to the tracepoint docbook
Namhyung Kim (2):
workqueue: annotate lock context change
workqueue: mark lock acquisition on worker_maybe_bind_and_lock()
Tejun Heo (4):
workqueue: improve destroy_workqueue() debuggability
workqueue: fix cwq->nr_active underflow
workqueue: fix GCWQ_DISASSOCIATED initialization
workqueue: use zalloc_cpumask_var() for gcwq->mayday_mask
Xiaotian Feng (1):
workqueue: free rescuer on destroy_workqueue
Documentation/DocBook/tracepoint.tmpl | 5 +++ include/linux/workqueue.h | 18 +++++++---- kernel/workqueue.c | 53 +++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 22 deletions(-)
Documentation/DocBook/tracepoint.tmpl +5 -0
@@ -104,4 +104,9 @@ <title>Block IO</title> !Iinclude/trace/events/block.h </chapter> + + <chapter id="workqueue"> + <title>Workqueue</title> +!Iinclude/trace/events/workqueue.h + </chapter> </book>
include/linux/workqueue.h +11 -7
@@ -25,18 +25,20 @@ typedef void (*work_func_t)(struct work_struct *work);enum {WORK_STRUCT_PENDING_BIT =0 ,/* work item is pending execution */ -WORK_STRUCT_CWQ_BIT =1 ,/* data points to cwq */ -WORK_STRUCT_LINKED_BIT =2 ,/* next work is linked to this one */ +WORK_STRUCT_DELAYED_BIT =1 ,/* work item is delayed */ +WORK_STRUCT_CWQ_BIT =2 ,/* data points to cwq */ +WORK_STRUCT_LINKED_BIT =3 ,/* next work is linked to this one */ #ifdef CONFIG_DEBUG_OBJECTS_WORK -WORK_STRUCT_STATIC_BIT =3 ,/* static initializer (debugobjects) */ -WORK_STRUCT_COLOR_SHIFT =4 ,/* color for workqueue flushing */ +WORK_STRUCT_STATIC_BIT =4 ,/* static initializer (debugobjects) */ +WORK_STRUCT_COLOR_SHIFT =5 ,/* color for workqueue flushing */ #else -WORK_STRUCT_COLOR_SHIFT =3 ,/* color for workqueue flushing */ +WORK_STRUCT_COLOR_SHIFT =4 ,/* color for workqueue flushing */ #endif WORK_STRUCT_COLOR_BITS =4 ,WORK_STRUCT_PENDING =1 <<WORK_STRUCT_PENDING_BIT , +WORK_STRUCT_DELAYED =1 <<WORK_STRUCT_DELAYED_BIT ,WORK_STRUCT_CWQ =1 <<WORK_STRUCT_CWQ_BIT ,WORK_STRUCT_LINKED =1 <<WORK_STRUCT_LINKED_BIT ,#ifdef CONFIG_DEBUG_OBJECTS_WORK
@@ -59,8 +61,8 @@ enum {/* * Reserve 7 bits off of cwq pointer w/ debugobjects turned -* off. This makes cwqs aligned to 128 bytes which isn't too -* excessive while allowing 15 workqueue flush colors. +* off. This makes cwqs aligned to 256 bytes and allows 15 +* workqueue flush colors. */ WORK_STRUCT_FLAG_BITS =WORK_STRUCT_COLOR_SHIFT + WORK_STRUCT_COLOR_BITS,
@@ -241,6 +243,8 @@ enum {WQ_HIGHPRI =1 <<4 ,/* high priority */ WQ_CPU_INTENSIVE =1 <<5 ,/* cpu instensive workqueue */ +WQ_DYING =1 <<6 ,/* internal: workqueue is dying */ +WQ_MAX_ACTIVE =512 ,/* I like 512, better ideas? */ WQ_MAX_UNBOUND_PER_CPU =4 ,/* 4 * #cpus for unbound wq */ WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2,
kernel/workqueue.c +38 -15
178 lines not on this page · raw message