<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/workqueue.c, branch v5.7</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=v5.7</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-04-08T09:35:20Z</updated>
<entry>
<title>workqueue: Remove the warning in wq_worker_sleeping()</title>
<updated>2020-04-08T09:35:20Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2020-03-27T23:29:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=62849a9612924a655c67cf6962920544aa5c20db'/>
<id>urn:sha1:62849a9612924a655c67cf6962920544aa5c20db</id>
<content type='text'>
The kernel test robot triggered a warning with the following race:
   task-ctx A                            interrupt-ctx B
 worker
  -&gt; process_one_work()
    -&gt; work_item()
      -&gt; schedule();
         -&gt; sched_submit_work()
           -&gt; wq_worker_sleeping()
             -&gt; -&gt;sleeping = 1
               atomic_dec_and_test(nr_running)
         __schedule();                *interrupt*
                                       async_page_fault()
                                       -&gt; local_irq_enable();
                                       -&gt; schedule();
                                          -&gt; sched_submit_work()
                                            -&gt; wq_worker_sleeping()
                                               -&gt; if (WARN_ON(-&gt;sleeping)) return
                                          -&gt; __schedule()
                                            -&gt;  sched_update_worker()
                                              -&gt; wq_worker_running()
                                                 -&gt; atomic_inc(nr_running);
                                                 -&gt; -&gt;sleeping = 0;

      -&gt;  sched_update_worker()
        -&gt; wq_worker_running()
          if (!-&gt;sleeping) return

In this context the warning is pointless everything is fine.
An interrupt before wq_worker_sleeping() will perform the -&gt;sleeping
assignment (0 -&gt; 1 &gt; 0) twice.
An interrupt after wq_worker_sleeping() will trigger the warning and
nr_running will be decremented (by A) and incremented once (only by B, A
will skip it). This is the case until the -&gt;sleeping is zeroed again in
wq_worker_running().

Remove the WARN statement because this condition may happen. Document
that preemption around wq_worker_sleeping() needs to be disabled to
protect -&gt;sleeping and not just as an optimisation.

Fixes: 6d25be5782e48 ("sched/core, workqueues: Distangle worker accounting from rq lock")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Link: https://lkml.kernel.org/r/20200327074308.GY11705@shao2-debian
</content>
</entry>
<entry>
<title>Merge branch 'for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq</title>
<updated>2020-04-03T19:27:36Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-04-03T19:27:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0adb8bc0391f1fa7820529c0200fb0c4912fe365'/>
<id>urn:sha1:0adb8bc0391f1fa7820529c0200fb0c4912fe365</id>
<content type='text'>
Pull workqueue updates from Tejun Heo:
 "Nothing too interesting. Just two trivial patches"

* 'for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  workqueue: Mark up unlocked access to wq-&gt;first_flusher
  workqueue: Make workqueue_init*() return void
</content>
</entry>
<entry>
<title>workqueue: Mark up unlocked access to wq-&gt;first_flusher</title>
<updated>2020-03-12T18:26:50Z</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2020-03-10T16:23:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=00d5d15b0641f4ae463253eba06c836d56c2ce42'/>
<id>urn:sha1:00d5d15b0641f4ae463253eba06c836d56c2ce42</id>
<content type='text'>
[ 7329.671518] BUG: KCSAN: data-race in flush_workqueue / flush_workqueue
[ 7329.671549]
[ 7329.671572] write to 0xffff8881f65fb250 of 8 bytes by task 37173 on cpu 2:
[ 7329.671607]  flush_workqueue+0x3bc/0x9b0 (kernel/workqueue.c:2844)
[ 7329.672527]
[ 7329.672540] read to 0xffff8881f65fb250 of 8 bytes by task 37175 on cpu 0:
[ 7329.672571]  flush_workqueue+0x28d/0x9b0 (kernel/workqueue.c:2835)

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Lai Jiangshan &lt;jiangshanlai@gmail.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: don't use wq_select_unbound_cpu() for bound works</title>
<updated>2020-03-10T14:30:51Z</updated>
<author>
<name>Hillf Danton</name>
<email>hdanton@sina.com</email>
</author>
<published>2020-01-25T01:14:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aa202f1f56960c60e7befaa0f49c72b8fa11b0a8'/>
<id>urn:sha1:aa202f1f56960c60e7befaa0f49c72b8fa11b0a8</id>
<content type='text'>
wq_select_unbound_cpu() is designed for unbound workqueues only, but
it's wrongly called when using a bound workqueue too.

Fixing this ensures work queued to a bound workqueue with
cpu=WORK_CPU_UNBOUND always runs on the local CPU.

Before, that would happen only if wq_unbound_cpumask happened to include
it (likely almost always the case), or was empty, or we got lucky with
forced round-robin placement.  So restricting
/sys/devices/virtual/workqueue/cpumask to a small subset of a machine's
CPUs would cause some bound work items to run unexpectedly there.

Fixes: ef557180447f ("workqueue: schedule WORK_CPU_UNBOUND work on wq_unbound_cpumask CPUs")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Hillf Danton &lt;hdanton@sina.com&gt;
[dj: massage changelog]
Signed-off-by: Daniel Jordan &lt;daniel.m.jordan@oracle.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Lai Jiangshan &lt;jiangshanlai@gmail.com&gt;
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: Make workqueue_init*() return void</title>
<updated>2020-03-04T16:21:49Z</updated>
<author>
<name>Yu Chen</name>
<email>chen.yu@easystack.cn</email>
</author>
<published>2020-02-23T07:28:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2333e829952fb437db915bbb17f4d8c43127d438'/>
<id>urn:sha1:2333e829952fb437db915bbb17f4d8c43127d438</id>
<content type='text'>
The return values of workqueue_init() and workqueue_early_int() are
always 0, and there is no usage of their return value.  So just make
them return void.

Signed-off-by: Yu Chen &lt;chen.yu@easystack.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2020-01-28T18:07:09Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-01-28T18:07:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c677124e631d97130e4ff7db6e10acdfb7a82321'/>
<id>urn:sha1:c677124e631d97130e4ff7db6e10acdfb7a82321</id>
<content type='text'>
Pull scheduler updates from Ingo Molnar:
 "These were the main changes in this cycle:

   - More -rt motivated separation of CONFIG_PREEMPT and
     CONFIG_PREEMPTION.

   - Add more low level scheduling topology sanity checks and warnings
     to filter out nonsensical topologies that break scheduling.

   - Extend uclamp constraints to influence wakeup CPU placement

   - Make the RT scheduler more aware of asymmetric topologies and CPU
     capacities, via uclamp metrics, if CONFIG_UCLAMP_TASK=y

   - Make idle CPU selection more consistent

   - Various fixes, smaller cleanups, updates and enhancements - please
     see the git log for details"

* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (58 commits)
  sched/fair: Define sched_idle_cpu() only for SMP configurations
  sched/topology: Assert non-NUMA topology masks don't (partially) overlap
  idle: fix spelling mistake "iterrupts" -&gt; "interrupts"
  sched/fair: Remove redundant call to cpufreq_update_util()
  sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
  sched/fair: Fix sgc-&gt;{min,max}_capacity calculation for SD_OVERLAP
  sched/fair: calculate delta runnable load only when it's needed
  sched/cputime: move rq parameter in irqtime_account_process_tick
  stop_machine: Make stop_cpus() static
  sched/debug: Reset watchdog on all CPUs while processing sysrq-t
  sched/core: Fix size of rq::uclamp initialization
  sched/uclamp: Fix a bug in propagating uclamp value in new cgroups
  sched/fair: Load balance aggressively for SCHED_IDLE CPUs
  sched/fair : Improve update_sd_pick_busiest for spare capacity case
  watchdog: Remove soft_lockup_hrtimer_cnt and related code
  sched/rt: Make RT capacity-aware
  sched/fair: Make EAS wakeup placement consider uclamp restrictions
  sched/fair: Make task_fits_capacity() consider uclamp restrictions
  sched/uclamp: Rename uclamp_util_with() into uclamp_rq_util_with()
  sched/uclamp: Make uclamp util helpers use and return UL values
  ...
</content>
</entry>
<entry>
<title>workqueue: add worker function to workqueue_execute_end tracepoint</title>
<updated>2020-01-15T16:02:47Z</updated>
<author>
<name>Daniel Jordan</name>
<email>daniel.m.jordan@oracle.com</email>
</author>
<published>2020-01-13T22:52:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1c5da0ec7f20dfb56030fb93f7f52f48e12deb52'/>
<id>urn:sha1:1c5da0ec7f20dfb56030fb93f7f52f48e12deb52</id>
<content type='text'>
It's surprising that workqueue_execute_end includes only the work when
its counterpart workqueue_execute_start has both the work and the worker
function.

You can't set a tracing filter or trigger based on the function, and
postprocessing scripts interested in specific functions are harder to
write since they have to remember the work from _start and match it up
with the same field in _end.

Add the function name, taking care to use the copy stashed in the
worker since the work is no longer safe to touch.

Signed-off-by: Daniel Jordan &lt;daniel.m.jordan@oracle.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Lai Jiangshan &lt;jiangshanlai@gmail.com&gt;
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'v5.5-rc3' into sched/core, to pick up fixes</title>
<updated>2019-12-25T09:41:37Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@kernel.org</email>
</author>
<published>2019-12-25T09:41:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1e5f8a308551b9816588e12bb795aeadebe37c4a'/>
<id>urn:sha1:1e5f8a308551b9816588e12bb795aeadebe37c4a</id>
<content type='text'>
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>sched/rt, workqueue: Use PREEMPTION</title>
<updated>2019-12-08T13:37:37Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2019-10-15T19:18:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=025f50f3866486a5278afa91f0d3b6b780141050'/>
<id>urn:sha1:025f50f3866486a5278afa91f0d3b6b780141050</id>
<content type='text'>
CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT.
Both PREEMPT and PREEMPT_RT require the same functionality which today
depends on CONFIG_PREEMPT.

Update the comment to use PREEMPTION because it is true for both
preemption models.

Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Lai Jiangshan &lt;jiangshanlai@gmail.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Link: https://lore.kernel.org/r/20191015191821.11479-35-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: Use pr_warn instead of pr_warning</title>
<updated>2019-12-06T08:59:30Z</updated>
<author>
<name>Kefeng Wang</name>
<email>wangkefeng.wang@huawei.com</email>
</author>
<published>2019-11-28T00:47:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1d9a6159bd04b676cb7d9b13245888fa450cec10'/>
<id>urn:sha1:1d9a6159bd04b676cb7d9b13245888fa450cec10</id>
<content type='text'>
Use pr_warn() instead of the remaining pr_warning() calls.

Link: http://lkml.kernel.org/r/20191128004752.35268-2-wangkefeng.wang@huawei.com
To: joe@perches.com
To: linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org
Cc: tj@kernel.org
Cc: arnd@arndb.de
Cc: sergey.senozhatsky@gmail.com
Cc: rostedt@goodmis.org
Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</content>
</entry>
</feed>
