]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[PATCH] fix workqueue oops during cpu offline
authorNathan Lynch <ntl@pobox.com>
Sun, 8 Jan 2006 09:05:12 +0000 (01:05 -0800)
committerChris Wright <chrisw@sous-sol.org>
Sun, 15 Jan 2006 06:15:28 +0000 (22:15 -0800)
commit4e5ae24c6485ea49e61bdafb3e4d4d598bf5b1dc
tree20368dec5ce92a15f182bebc4a68e41924c57e7b
parent2d7fc97cea8a45158bc6428a3f99782e41e6b5c3
[PATCH] fix workqueue oops during cpu offline

Use first_cpu(cpu_possible_map) for the single-thread workqueue case.  We
used to hardcode 0, but that broke on systems where !cpu_possible(0) when
workqueue_struct->cpu_workqueue_struct was changed from a static array to
alloc_percpu.

Commit id bce61dd49d6ba7799be2de17c772e4c701558f14 ("Fix hardcoded cpu=0 in
workqueue for per_cpu_ptr() calls") fixed that for Ben's funky sparc64
system, but it regressed my Power5.  Offlining cpu 0 oopses upon the next
call to queue_work for a single-thread workqueue, because now we try to
manipulate per_cpu_ptr(wq->cpu_wq, 1), which is uninitialized.

So we need to establish an unchanging "slot" for single-thread workqueues
which will have a valid percpu allocation.  Since alloc_percpu keys off of
cpu_possible_map, which must not change after initialization, make this
slot == first_cpu(cpu_possible_map).

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
kernel/workqueue.c