[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151013214952.GB23106@mtj.duckdns.org>
Date:	Tue, 13 Oct 2015 17:49:52 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org,
	Lai Jiangshan <jiangshanlai@...il.com>,
	Shaohua Li <shli@...com>
Subject: [GIT PULL] workqueue fixes for v4.3-rc5
Hello, Linus.
Single patch to fix delayed work being queued on the wrong CPU.  This
has been broken forever (v2.6.31+) but obviously doesn't trigger in
most configurations.
Thanks.
The following changes since commit 9ffecb10283508260936b96022d4ee43a7798b4c:
  Linux 4.3-rc3 (2015-09-27 07:50:08 -0400)
are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-4.3-fixes
for you to fetch changes up to 874bbfe600a660cba9c776b3957b1ce393151b76:
  workqueue: make sure delayed work run in local cpu (2015-09-30 13:06:46 -0400)
----------------------------------------------------------------
Shaohua Li (1):
      workqueue: make sure delayed work run in local cpu
 kernel/workqueue.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca71582..bcb14ca 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1458,13 +1458,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
 	timer_stats_timer_set_start_info(&dwork->timer);
 
 	dwork->wq = wq;
+	/* timer isn't guaranteed to run in this cpu, record earlier */
+	if (cpu == WORK_CPU_UNBOUND)
+		cpu = raw_smp_processor_id();
 	dwork->cpu = cpu;
 	timer->expires = jiffies + delay;
 
-	if (unlikely(cpu != WORK_CPU_UNBOUND))
-		add_timer_on(timer, cpu);
-	else
-		add_timer(timer);
+	add_timer_on(timer, cpu);
 }
 
 /**
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists