summaryrefslogtreecommitdiffstats
path: root/patches/kernel-workqueue-Add-PF_THREAD_BOUND-after-set_cpu.patch
blob: d3e2d02a107394caa2050e5d643d6c06af937a33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From f270f2b228eb2901edc44816d1ab8a511bac0383 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Fri, 7 Jun 2013 16:03:56 +0200
Subject: [PATCH] kernel/workqueue: Add PF_THREAD_BOUND after set_cpu

This is just a precaution for now. There are reports that the flag is
getting lost. I could only notice this on workqueues due to another bug.
So this should WARN_ON should no trigger. If it does, investigations may
begin.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/workqueue.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1637,8 +1637,11 @@ __acquires(&gcwq->lock)
 		 * it races with cpu hotunplug operation.  Verify
 		 * against GCWQ_DISASSOCIATED.
 		 */
-		if (!(gcwq->flags & GCWQ_DISASSOCIATED))
+		if (!(gcwq->flags & GCWQ_DISASSOCIATED)) {
 			set_cpus_allowed_ptr(task, get_cpu_mask(gcwq->cpu));
+			if (WARN_ON(!(task->flags & PF_THREAD_BOUND)))
+				task->flags |= PF_THREAD_BOUND;
+		}
 
 		spin_lock_irq(&gcwq->lock);
 		if (gcwq->flags & GCWQ_DISASSOCIATED)