<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/workqueue.c, branch v3.11</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.11</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.11'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2013-08-29T13:19:28Z</updated>
<entry>
<title>workqueue: cond_resched() after processing each work item</title>
<updated>2013-08-29T13:19:28Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2013-08-28T21:33:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b22ce2785d97423846206cceec4efee0c4afd980'/>
<id>urn:sha1:b22ce2785d97423846206cceec4efee0c4afd980</id>
<content type='text'>
If !PREEMPT, a kworker running work items back to back can hog CPU.
This becomes dangerous when a self-requeueing work item which is
waiting for something to happen races against stop_machine.  Such
self-requeueing work item would requeue itself indefinitely hogging
the kworker and CPU it's running on while stop_machine would wait for
that CPU to enter stop_machine while preventing anything else from
happening on all other CPUs.  The two would deadlock.

Jamie Liu reports that this deadlock scenario exists around
scsi_requeue_run_queue() and libata port multiplier support, where one
port may exclude command processing from other ports.  With the right
timing, scsi_requeue_run_queue() can end up requeueing itself trying
to execute an IO which is asked to be retried while another device has
an exclusive access, which in turn can't make forward progress due to
stop_machine.

Fix it by invoking cond_resched() after executing each work item.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Jamie Liu &lt;jamieliu@google.com&gt;
References: http://thread.gmane.org/gmane.linux.kernel/1552567
Cc: stable@vger.kernel.org
--
 kernel/workqueue.c |    9 +++++++++
 1 file changed, 9 insertions(+)
</content>
</entry>
<entry>
<title>Merge branch 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq</title>
<updated>2013-08-06T20:58:34Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2013-08-06T20:58:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4264bc13712b40be38d8fc01a37c34279a27e30d'/>
<id>urn:sha1:4264bc13712b40be38d8fc01a37c34279a27e30d</id>
<content type='text'>
Pull two workqueue fixes from Tejun Heo:
 "A lockdep notation update so that nested work_on_cpu() invocations
  don't lead to spurious lockdep warnings and fix for an unbound attr
  bug which made what's shown in sysfs deviate from the actual ones.
  Both patches have pretty limited scope"

* 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  workqueue: copy workqueue_attrs with all fields
  workqueue: allow work_on_cpu() to be called recursively
</content>
</entry>
<entry>
<title>workqueue: copy workqueue_attrs with all fields</title>
<updated>2013-08-01T12:36:40Z</updated>
<author>
<name>Shaohua Li</name>
<email>shli@kernel.org</email>
</author>
<published>2013-08-01T01:56:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2865a8fb44cc32420407362cbda80c10fa09c6b2'/>
<id>urn:sha1:2865a8fb44cc32420407362cbda80c10fa09c6b2</id>
<content type='text'>
 $echo '0' &gt; /sys/bus/workqueue/devices/xxx/numa
 $cat /sys/bus/workqueue/devices/xxx/numa

I got 1. It should be 0, the reason is copy_workqueue_attrs() called
in apply_workqueue_attrs() doesn't copy no_numa field.

Fix it by making copy_workqueue_attrs() copy -&gt;no_numa too.  This
would also make get_unbound_pool() set a pool's -&gt;no_numa attribute
according to the workqueue attributes used when the pool was created.
While harmelss, as -&gt;no_numa isn't a pool attribute, this is a bit
confusing.  Clear it explicitly.

tj: Updated description and comments a bit.

Signed-off-by: Shaohua Li &lt;shli@fusionio.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>workqueue: allow work_on_cpu() to be called recursively</title>
<updated>2013-07-24T16:24:25Z</updated>
<author>
<name>Lai Jiangshan</name>
<email>laijs@cn.fujitsu.com</email>
</author>
<published>2013-07-24T10:31:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c2fda509667b0fda4372a237f5a59ea4570b1627'/>
<id>urn:sha1:c2fda509667b0fda4372a237f5a59ea4570b1627</id>
<content type='text'>
If the @fn call work_on_cpu() again, the lockdep will complain:

&gt; [ INFO: possible recursive locking detected ]
&gt; 3.11.0-rc1-lockdep-fix-a #6 Not tainted
&gt; ---------------------------------------------
&gt; kworker/0:1/142 is trying to acquire lock:
&gt;  ((&amp;wfc.work)){+.+.+.}, at: [&lt;ffffffff81077100&gt;] flush_work+0x0/0xb0
&gt;
&gt; but task is already holding lock:
&gt;  ((&amp;wfc.work)){+.+.+.}, at: [&lt;ffffffff81075dd9&gt;] process_one_work+0x169/0x610
&gt;
&gt; other info that might help us debug this:
&gt;  Possible unsafe locking scenario:
&gt;
&gt;        CPU0
&gt;        ----
&gt;   lock((&amp;wfc.work));
&gt;   lock((&amp;wfc.work));
&gt;
&gt;  *** DEADLOCK ***

It is false-positive lockdep report. In this sutiation,
the two "wfc"s of the two work_on_cpu() are different,
they are both on stack. flush_work() can't be deadlock.

To fix this, we need to avoid the lockdep checking in this case,
thus we instroduce a internal __flush_work() which skip the lockdep.

tj: Minor comment adjustment.

Signed-off-by: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Reported-by: "Srivatsa S. Bhat" &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Reported-by: Alexander Duyck &lt;alexander.h.duyck@intel.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>kernel: delete __cpuinit usage from all core kernel files</title>
<updated>2013-07-14T23:36:59Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2013-06-19T18:53:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0db0628d90125193280eabb501c94feaf48fa9ab'/>
<id>urn:sha1:0db0628d90125193280eabb501c94feaf48fa9ab</id>
<content type='text'>
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications.  For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.

After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out.  Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.

This removes all the uses of the __cpuinit macros from C files in
the core kernel directories (kernel, init, lib, mm, and include)
that don't really have a specific maintainer.

[1] https://lkml.org/lkml/2013/5/20/589

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq</title>
<updated>2013-07-03T02:53:30Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2013-07-03T02:53:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f317ff9eed763e99bd226a447f93d42509434f43'/>
<id>urn:sha1:f317ff9eed763e99bd226a447f93d42509434f43</id>
<content type='text'>
Pull workqueue changes from Tejun Heo:
 "Surprisingly, Lai and I didn't break too many things implementing
  custom pools and stuff last time around and there aren't any follow-up
  changes necessary at this point.

  The only change in this pull request is Viresh's patches to make some
  per-cpu workqueues to behave as unbound workqueues dependent on a boot
  param whose default can be configured via a config option.  This leads
  to higher processing overhead / lower bandwidth as more work items are
  bounced across CPUs; however, it can lead to noticeable powersave in
  certain configurations - ~10% w/ idlish constant workload on a
  big.LITTLE configuration according to Viresh.

  This is because per-cpu workqueues interfere with how the scheduler
  perceives whether or not each CPU is idle by forcing pinned tasks on
  them, which makes the scheduler's power-aware scheduling decisions
  less effective.

  Its effectiveness is likely less pronounced on homogenous
  configurations and this type of optimization can probably be made
  automatic; however, the changes are pretty minimal and the affected
  workqueues are clearly marked, so it's an easy gain for some
  configurations for the time being with pretty unintrusive changes."

* 'for-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  fbcon: queue work on power efficient wq
  block: queue work on power efficient wq
  PHYLIB: queue work on system_power_efficient_wq
  workqueue: Add system wide power_efficient workqueues
  workqueues: Introduce new flag WQ_POWER_EFFICIENT for power oriented workqueues
</content>
</entry>
<entry>
<title>workqueue: don't perform NUMA-aware allocations on offline nodes in wq_numa_init()</title>
<updated>2013-05-15T21:24:24Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2013-05-15T21:24:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1be0c25da56e860992af972a60321563ca2cfcd1'/>
<id>urn:sha1:1be0c25da56e860992af972a60321563ca2cfcd1</id>
<content type='text'>
wq_numa_init() builds per-node cpumasks which are later used to make
unbound workqueues NUMA-aware.  The cpumasks are allocated using
alloc_cpumask_var_node() for all possible nodes.  Unfortunately, on
machines with off-line nodes, this leads to NUMA-aware allocations on
existing bug offline nodes, which in turn triggers BUG in the memory
allocation code.

Fix it by using NUMA_NO_NODE for cpumask allocations for offline
nodes.

  kernel BUG at include/linux/gfp.h:323!
  invalid opcode: 0000 [#1] SMP
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0+ #1
  Hardware name: ProLiant BL465c G7, BIOS A19 12/10/2011
  task: ffff880234608000 ti: ffff880234602000 task.ti: ffff880234602000
  RIP: 0010:[&lt;ffffffff8117495d&gt;]  [&lt;ffffffff8117495d&gt;] new_slab+0x2ad/0x340
  RSP: 0000:ffff880234603bf8  EFLAGS: 00010246
  RAX: 0000000000000000 RBX: ffff880237404b40 RCX: 00000000000000d0
  RDX: 0000000000000001 RSI: 0000000000000003 RDI: 00000000002052d0
  RBP: ffff880234603c28 R08: 0000000000000000 R09: 0000000000000001
  R10: 0000000000000001 R11: ffffffff812e3aa8 R12: 0000000000000001
  R13: ffff8802378161c0 R14: 0000000000030027 R15: 00000000000040d0
  FS:  0000000000000000(0000) GS:ffff880237800000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: ffff88043fdff000 CR3: 00000000018d5000 CR4: 00000000000007f0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
  Stack:
   ffff880234603c28 0000000000000001 00000000000000d0 ffff8802378161c0
   ffff880237404b40 ffff880237404b40 ffff880234603d28 ffffffff815edba1
   ffff880237816140 0000000000000000 ffff88023740e1c0
  Call Trace:
   [&lt;ffffffff815edba1&gt;] __slab_alloc+0x330/0x4f2
   [&lt;ffffffff81174b25&gt;] kmem_cache_alloc_node_trace+0xa5/0x200
   [&lt;ffffffff812e3aa8&gt;] alloc_cpumask_var_node+0x28/0x90
   [&lt;ffffffff81a0bdb3&gt;] wq_numa_init+0x10d/0x1be
   [&lt;ffffffff81a0bec8&gt;] init_workqueues+0x64/0x341
   [&lt;ffffffff810002ea&gt;] do_one_initcall+0xea/0x1a0
   [&lt;ffffffff819f1f31&gt;] kernel_init_freeable+0xb7/0x1ec
   [&lt;ffffffff815d50de&gt;] kernel_init+0xe/0xf0
   [&lt;ffffffff815ff89c&gt;] ret_from_fork+0x7c/0xb0
  Code: 45  84 ac 00 00 00 f0 41 80 4d 00 40 e9 f6 fe ff ff 66 0f 1f 84 00 00 00 00 00 e8 eb 4b ff ff 49 89 c5 e9 05 fe ff ff &lt;0f&gt; 0b 4c 8b 73 38 44 89 ff 81 cf 00 00 20 00 4c 89 f6 48 c1 ee

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-Tested-by: Lingzhu Xiang &lt;lxiang@redhat.com&gt;
</content>
</entry>
<entry>
<title>workqueue: Make schedule_work() available again to non GPL modules</title>
<updated>2013-05-14T18:52:51Z</updated>
<author>
<name>Marc Dionne</name>
<email>marc.c.dionne@gmail.com</email>
</author>
<published>2013-05-06T21:44:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ad7b1f841f8a54c6d61ff181451f55b68175e15a'/>
<id>urn:sha1:ad7b1f841f8a54c6d61ff181451f55b68175e15a</id>
<content type='text'>
Commit 8425e3d5bdbe ("workqueue: inline trivial wrappers") changed
schedule_work() and schedule_delayed_work() to inline wrappers,
but these rely on some symbols that are EXPORT_SYMBOL_GPL, while
the original functions were EXPORT_SYMBOL.  This has the effect of
changing the licensing requirement for these functions and making
them unavailable to non GPL modules.

Make them available again by removing the restriction on the
required symbols.

Signed-off-by: Marc Dionne &lt;marc.dionne@your-file-system.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: correct handling of the pool spin_lock</title>
<updated>2013-05-14T18:48:15Z</updated>
<author>
<name>Joonsoo Kim</name>
<email>js1304@gmail.com</email>
</author>
<published>2013-04-30T15:07:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8f174b1175a10903ade40f36eb6c896412877ca0'/>
<id>urn:sha1:8f174b1175a10903ade40f36eb6c896412877ca0</id>
<content type='text'>
When we fail to mutex_trylock(), we release the pool spin_lock and do
mutex_lock(). After that, we should regrab the pool spin_lock, but,
regrabbing is missed in current code. So correct it.

Cc: Lai Jiangshan &lt;laijs@cn.fujitsu.com&gt;
Signed-off-by: Joonsoo Kim &lt;iamjoonsoo.kim@lge.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: Add system wide power_efficient workqueues</title>
<updated>2013-05-14T17:50:06Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2013-04-24T11:42:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0668106ca3865ba945e155097fb042bf66d364d3'/>
<id>urn:sha1:0668106ca3865ba945e155097fb042bf66d364d3</id>
<content type='text'>
This patch adds system wide workqueues aligned towards power saving. This is
done by allocating them with WQ_UNBOUND flag if 'wq_power_efficient' is set to
'true'.

tj: updated comments a bit.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
</feed>
