<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/workqueue.h, branch v4.9.69</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.69</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.69'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-09-09T15:39:41Z</updated>
<entry>
<title>workqueue: Fix flag collision</title>
<updated>2017-09-09T15:39:41Z</updated>
<author>
<name>Ben Hutchings</name>
<email>ben@decadent.org.uk</email>
</author>
<published>2017-09-03T00:18:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ec552ece1f25e8ecadf0afafe87ce314d13dc3e7'/>
<id>urn:sha1:ec552ece1f25e8ecadf0afafe87ce314d13dc3e7</id>
<content type='text'>
commit fbf1c41fc0f4d3574ac2377245efd666c1fa3075 upstream.

Commit 0a94efb5acbb ("workqueue: implicit ordered attribute should be
overridable") introduced a __WQ_ORDERED_EXPLICIT flag but gave it the
same value as __WQ_LEGACY.  I don't believe these were intended to
mean the same thing, so renumber __WQ_ORDERED_EXPLICIT.

Fixes: 0a94efb5acbb ("workqueue: implicit ordered attribute should be ...")
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>workqueue: implicit ordered attribute should be overridable</title>
<updated>2017-08-11T15:49:37Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2017-07-23T12:36:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f9636c9bdd5828f29cdfaf620e3a424a5f8cc221'/>
<id>urn:sha1:f9636c9bdd5828f29cdfaf620e3a424a5f8cc221</id>
<content type='text'>
commit 0a94efb5acbb6980d7c9ab604372d93cd507e4d8 upstream.

5c0338c68706 ("workqueue: restore WQ_UNBOUND/max_active==1 to be
ordered") automatically enabled ordered attribute for unbound
workqueues w/ max_active == 1.  Because ordered workqueues reject
max_active and some attribute changes, this implicit ordered mode
broke cases where the user creates an unbound workqueue w/ max_active
== 1 and later explicitly changes the related attributes.

This patch distinguishes explicit and implicit ordered setting and
overrides from attribute changes if implict.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Fixes: 5c0338c68706 ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered")
Cc: Holger Hoffstätte &lt;holger@applied-asynchrony.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>workqueue: add cancel_work()</title>
<updated>2016-08-29T14:13:21Z</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@fb.com</email>
</author>
<published>2016-08-24T21:51:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f72b8792d180948b4b3898374998f5ac8c02e539'/>
<id>urn:sha1:f72b8792d180948b4b3898374998f5ac8c02e539</id>
<content type='text'>
Like cancel_delayed_work(), but for regular work.

Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Mehed-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: Convert to state machine callbacks</title>
<updated>2016-07-14T07:34:43Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2016-07-13T17:16:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7ee681b25284782ecf380bf5ccf55f13c52fd0ce'/>
<id>urn:sha1:7ee681b25284782ecf380bf5ccf55f13c52fd0ce</id>
<content type='text'>
Get rid of the prio ordering of the separate notifiers and use a proper state
callback pair.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Anna-Maria Gleixner &lt;anna-maria@linutronix.de&gt;
Reviewed-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Lai Jiangshan &lt;jiangshanlai@gmail.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Nicolas Iooss &lt;nicolas.iooss_linux@m4x.org&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153335.197083890@linutronix.de
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: skip flush dependency checks for legacy workqueues</title>
<updated>2016-01-29T18:31:10Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2016-01-29T10:59:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=23d11a58a9a60dcb52c8fc6494efce908b24c295'/>
<id>urn:sha1:23d11a58a9a60dcb52c8fc6494efce908b24c295</id>
<content type='text'>
fca839c00a12 ("workqueue: warn if memory reclaim tries to flush
!WQ_MEM_RECLAIM workqueue") implemented flush dependency warning which
triggers if a PF_MEMALLOC task or WQ_MEM_RECLAIM workqueue tries to
flush a !WQ_MEM_RECLAIM workquee.

This assumes that workqueues marked with WQ_MEM_RECLAIM sit in memory
reclaim path and making it depend on something which may need more
memory to make forward progress can lead to deadlocks.  Unfortunately,
workqueues created with the legacy create*_workqueue() interface
always have WQ_MEM_RECLAIM regardless of whether they are depended
upon memory reclaim or not.  These spurious WQ_MEM_RECLAIM markings
cause spurious triggering of the flush dependency checks.

  WARNING: CPU: 0 PID: 6 at kernel/workqueue.c:2361 check_flush_dependency+0x138/0x144()
  workqueue: WQ_MEM_RECLAIM deferwq:deferred_probe_work_func is flushing !WQ_MEM_RECLAIM events:lru_add_drain_per_cpu
  ...
  Workqueue: deferwq deferred_probe_work_func
  [&lt;c0017acc&gt;] (unwind_backtrace) from [&lt;c0013134&gt;] (show_stack+0x10/0x14)
  [&lt;c0013134&gt;] (show_stack) from [&lt;c0245f18&gt;] (dump_stack+0x94/0xd4)
  [&lt;c0245f18&gt;] (dump_stack) from [&lt;c0026f9c&gt;] (warn_slowpath_common+0x80/0xb0)
  [&lt;c0026f9c&gt;] (warn_slowpath_common) from [&lt;c0026ffc&gt;] (warn_slowpath_fmt+0x30/0x40)
  [&lt;c0026ffc&gt;] (warn_slowpath_fmt) from [&lt;c00390b8&gt;] (check_flush_dependency+0x138/0x144)
  [&lt;c00390b8&gt;] (check_flush_dependency) from [&lt;c0039ca0&gt;] (flush_work+0x50/0x15c)
  [&lt;c0039ca0&gt;] (flush_work) from [&lt;c00c51b0&gt;] (lru_add_drain_all+0x130/0x180)
  [&lt;c00c51b0&gt;] (lru_add_drain_all) from [&lt;c00f728c&gt;] (migrate_prep+0x8/0x10)
  [&lt;c00f728c&gt;] (migrate_prep) from [&lt;c00bfbc4&gt;] (alloc_contig_range+0xd8/0x338)
  [&lt;c00bfbc4&gt;] (alloc_contig_range) from [&lt;c00f8f18&gt;] (cma_alloc+0xe0/0x1ac)
  [&lt;c00f8f18&gt;] (cma_alloc) from [&lt;c001cac4&gt;] (__alloc_from_contiguous+0x38/0xd8)
  [&lt;c001cac4&gt;] (__alloc_from_contiguous) from [&lt;c001ceb4&gt;] (__dma_alloc+0x240/0x278)
  [&lt;c001ceb4&gt;] (__dma_alloc) from [&lt;c001cf78&gt;] (arm_dma_alloc+0x54/0x5c)
  [&lt;c001cf78&gt;] (arm_dma_alloc) from [&lt;c0355ea4&gt;] (dmam_alloc_coherent+0xc0/0xec)
  [&lt;c0355ea4&gt;] (dmam_alloc_coherent) from [&lt;c039cc4c&gt;] (ahci_port_start+0x150/0x1dc)
  [&lt;c039cc4c&gt;] (ahci_port_start) from [&lt;c0384734&gt;] (ata_host_start.part.3+0xc8/0x1c8)
  [&lt;c0384734&gt;] (ata_host_start.part.3) from [&lt;c03898dc&gt;] (ata_host_activate+0x50/0x148)
  [&lt;c03898dc&gt;] (ata_host_activate) from [&lt;c039d558&gt;] (ahci_host_activate+0x44/0x114)
  [&lt;c039d558&gt;] (ahci_host_activate) from [&lt;c039f05c&gt;] (ahci_platform_init_host+0x1d8/0x3c8)
  [&lt;c039f05c&gt;] (ahci_platform_init_host) from [&lt;c039e6bc&gt;] (tegra_ahci_probe+0x448/0x4e8)
  [&lt;c039e6bc&gt;] (tegra_ahci_probe) from [&lt;c0347058&gt;] (platform_drv_probe+0x50/0xac)
  [&lt;c0347058&gt;] (platform_drv_probe) from [&lt;c03458cc&gt;] (driver_probe_device+0x214/0x2c0)
  [&lt;c03458cc&gt;] (driver_probe_device) from [&lt;c0343cc0&gt;] (bus_for_each_drv+0x60/0x94)
  [&lt;c0343cc0&gt;] (bus_for_each_drv) from [&lt;c03455d8&gt;] (__device_attach+0xb0/0x114)
  [&lt;c03455d8&gt;] (__device_attach) from [&lt;c0344ab8&gt;] (bus_probe_device+0x84/0x8c)
  [&lt;c0344ab8&gt;] (bus_probe_device) from [&lt;c0344f48&gt;] (deferred_probe_work_func+0x68/0x98)
  [&lt;c0344f48&gt;] (deferred_probe_work_func) from [&lt;c003b738&gt;] (process_one_work+0x120/0x3f8)
  [&lt;c003b738&gt;] (process_one_work) from [&lt;c003ba48&gt;] (worker_thread+0x38/0x55c)
  [&lt;c003ba48&gt;] (worker_thread) from [&lt;c0040f14&gt;] (kthread+0xdc/0xf4)
  [&lt;c0040f14&gt;] (kthread) from [&lt;c000f778&gt;] (ret_from_fork+0x14/0x3c)

Fix it by marking workqueues created via create*_workqueue() with
__WQ_LEGACY and disabling flush dependency checks on them.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-tested-by: Thierry Reding &lt;thierry.reding@gmail.com&gt;
Link: http://lkml.kernel.org/g/20160126173843.GA11115@ulmo.nvidia.com
Fixes: fca839c00a12 ("workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue")
</content>
</entry>
<entry>
<title>workqueue: implement lockup detector</title>
<updated>2015-12-08T16:29:47Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2015-12-08T16:28:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=82607adcf9cdf40fb7b5331269780c8f70ec6e35'/>
<id>urn:sha1:82607adcf9cdf40fb7b5331269780c8f70ec6e35</id>
<content type='text'>
Workqueue stalls can happen from a variety of usage bugs such as
missing WQ_MEM_RECLAIM flag or concurrency managed work item
indefinitely staying RUNNING.  These stalls can be extremely difficult
to hunt down because the usual warning mechanisms can't detect
workqueue stalls and the internal state is pretty opaque.

To alleviate the situation, this patch implements workqueue lockup
detector.  It periodically monitors all worker_pools periodically and,
if any pool failed to make forward progress longer than the threshold
duration, triggers warning and dumps workqueue state as follows.

 BUG: workqueue lockup - pool cpus=0 node=0 flags=0x0 nice=0 stuck for 31s!
 Showing busy workqueues and worker pools:
 workqueue events: flags=0x0
   pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=17/256
     pending: monkey_wrench_fn, e1000_watchdog, cache_reap, vmstat_shepherd, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, release_one_tty, cgroup_release_agent
 workqueue events_power_efficient: flags=0x80
   pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=2/256
     pending: check_lifetime, neigh_periodic_work
 workqueue cgroup_pidlist_destroy: flags=0x0
   pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/1
     pending: cgroup_pidlist_destroy_work_fn
 ...

The detection mechanism is controller through kernel parameter
workqueue.watchdog_thresh and can be updated at runtime through the
sysfs module parameter file.

v2: Decoupled from softlockup control knobs.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Don Zickus &lt;dzickus@redhat.com&gt;
Cc: Ulrich Obergfell &lt;uobergfe@redhat.com&gt;
Cc: Michal Hocko &lt;mhocko@suse.com&gt;
Cc: Chris Mason &lt;clm@fb.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>workqueue: fix some docbook warnings</title>
<updated>2015-08-17T19:48:24Z</updated>
<author>
<name>Jonathan Corbet</name>
<email>corbet@lwn.net</email>
</author>
<published>2015-08-13T23:52:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=355c06633e233a57155b827ebe99b91c35bc1f5c'/>
<id>urn:sha1:355c06633e233a57155b827ebe99b91c35bc1f5c</id>
<content type='text'>
There are some errors in the docbook comments in workqueue.h that cause
warnings when the docs are built; this only recently came to light because
these comments were not used until now.  Fix the comments to make the
warnings go away.

The "args..." "fix" is a hack.  kerneldoc doesn't deal properly with named
variadic arguments in macros, so all I've really achieved here is to make
it shut up.  Fixing kerneldoc will have to wait for more time.

Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: move flush_scheduled_work() to workqueue.h</title>
<updated>2015-05-21T21:26:22Z</updated>
<author>
<name>Lai Jiangshan</name>
<email>laijs@cn.fujitsu.com</email>
</author>
<published>2015-05-20T06:41:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=37b1ef31a568fc02e53587620226e5f3c66454c8'/>
<id>urn:sha1:37b1ef31a568fc02e53587620226e5f3c66454c8</id>
<content type='text'>
flush_scheduled_work() is just a simple call to flush_work().

Signed-off-by: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: Allow modifying low level unbound workqueue cpumask</title>
<updated>2015-04-30T13:24:29Z</updated>
<author>
<name>Lai Jiangshan</name>
<email>laijs@cn.fujitsu.com</email>
</author>
<published>2015-04-30T09:16:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=042f7df15a4fff8eec42873f755aea848dcdedd1'/>
<id>urn:sha1:042f7df15a4fff8eec42873f755aea848dcdedd1</id>
<content type='text'>
Allow to modify the low-level unbound workqueues cpumask through
sysfs. This is performed by traversing the entire workqueue list
and calling apply_wqattrs_prepare() on the unbound workqueues
with the new low level mask. Only after all the preparation are done,
we commit them all together.

Ordered workqueues are ignored from the low level unbound workqueue
cpumask, it will be handled in near future.

All the (default &amp; per-node) pwqs are mandatorily controlled by
the low level cpumask. If the user configured cpumask doesn't overlap
with the low level cpumask, the low level cpumask will be used for the
wq instead.

The comment of wq_calc_node_cpumask() is updated and explicitly
requires that its first argument should be the attrs of the default
pwq.

The default wq_unbound_cpumask is cpu_possible_mask.  The workqueue
subsystem doesn't know its best default value, let the system manager
or the other subsystem set it when needed.

Changed from V8:
  merge the calculating code for the attrs of the default pwq together.
  minor change the code&amp;comments for saving the user configured attrs.
  remove unnecessary list_del().
  minor update the comment of wq_calc_node_cpumask().
  update the comment of workqueue_set_unbound_cpumask();

Cc: Christoph Lameter &lt;cl@linux.com&gt;
Cc: Kevin Hilman &lt;khilman@linaro.org&gt;
Cc: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Cc: Mike Galbraith &lt;bitbucket@online.de&gt;
Cc: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Original-patch-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: dump workqueues on sysrq-t</title>
<updated>2015-03-09T13:22:28Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2015-03-09T13:22:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3494fc30846dceb808de4cc02930ef347fabd21a'/>
<id>urn:sha1:3494fc30846dceb808de4cc02930ef347fabd21a</id>
<content type='text'>
Workqueues are used extensively throughout the kernel but sometimes
it's difficult to debug stalls involving work items because visibility
into its inner workings is fairly limited.  Although sysrq-t task dump
annotates each active worker task with the information on the work
item being executed, it is challenging to find out which work items
are pending or delayed on which queues and how pools are being
managed.

This patch implements show_workqueue_state() which dumps all busy
workqueues and pools and is called from the sysrq-t handler.  At the
end of sysrq-t dump, something like the following is printed.

 Showing busy workqueues and worker pools:
 ...
 workqueue filler_wq: flags=0x0
   pwq 2: cpus=1 node=0 flags=0x0 nice=0 active=2/256
     in-flight: 491:filler_workfn, 507:filler_workfn
   pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=2/256
     in-flight: 501:filler_workfn
     pending: filler_workfn
 ...
 workqueue test_wq: flags=0x8
   pwq 2: cpus=1 node=0 flags=0x0 nice=0 active=1/1
     in-flight: 510(RESCUER):test_workfn BAR(69) BAR(500)
     delayed: test_workfn1 BAR(492), test_workfn2
 ...
 pool 0: cpus=0 node=0 flags=0x0 nice=0 workers=2 manager: 137
 pool 2: cpus=1 node=0 flags=0x0 nice=0 workers=3 manager: 469
 pool 3: cpus=1 node=0 flags=0x0 nice=-20 workers=2 idle: 16
 pool 8: cpus=0-3 flags=0x4 nice=0 workers=2 manager: 62

The above shows that test_wq is executing test_workfn() on pid 510
which is the rescuer and also that there are two tasks 69 and 500
waiting for the work item to finish in flush_work().  As test_wq has
max_active of 1, there are two work items for test_workfn1() and
test_workfn2() which are delayed till the current work item is
finished.  In addition, pid 492 is flushing test_workfn1().

The work item for test_workfn() is being executed on pwq of pool 2
which is the normal priority per-cpu pool for CPU 1.  The pool has
three workers, two of which are executing filler_workfn() for
filler_wq and the last one is assuming the manager role trying to
create more workers.

This extra workqueue state dump will hopefully help chasing down hangs
involving workqueues.

v3: cpulist_pr_cont() replaced with "%*pbl" printf formatting.

v2: As suggested by Andrew, minor formatting change in pr_cont_work(),
    printk()'s replaced with pr_info()'s, and cpumask printing now
    uses cpulist_pr_cont().

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
CC: Ingo Molnar &lt;mingo@redhat.com&gt;
</content>
</entry>
</feed>
