mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 07:31:41 +00:00
workqueue: fix build problem on !CONFIG_SMP
Commit f3421797
(workqueue: implement unbound workqueue) incorrectly
tested CONFIG_SMP as part of a C expression in alloc/free_cwqs(). As
CONFIG_SMP is not defined in UP, this breaks build. Fix it by using
Found during linux-next build test.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
This commit is contained in:
parent
9f9c23644b
commit
931ac77ef6
1 changed files with 14 additions and 4 deletions
|
@ -2615,11 +2615,15 @@ static int alloc_cwqs(struct workqueue_struct *wq)
|
||||||
const size_t size = sizeof(struct cpu_workqueue_struct);
|
const size_t size = sizeof(struct cpu_workqueue_struct);
|
||||||
const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
|
const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
|
||||||
__alignof__(unsigned long long));
|
__alignof__(unsigned long long));
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
bool percpu = !(wq->flags & WQ_UNBOUND);
|
||||||
|
#else
|
||||||
|
bool percpu = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (CONFIG_SMP && !(wq->flags & WQ_UNBOUND)) {
|
if (percpu)
|
||||||
/* on SMP, percpu allocator can align itself */
|
|
||||||
wq->cpu_wq.pcpu = __alloc_percpu(size, align);
|
wq->cpu_wq.pcpu = __alloc_percpu(size, align);
|
||||||
} else {
|
else {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2641,7 +2645,13 @@ static int alloc_cwqs(struct workqueue_struct *wq)
|
||||||
|
|
||||||
static void free_cwqs(struct workqueue_struct *wq)
|
static void free_cwqs(struct workqueue_struct *wq)
|
||||||
{
|
{
|
||||||
if (CONFIG_SMP && !(wq->flags & WQ_UNBOUND))
|
#ifdef CONFIG_SMP
|
||||||
|
bool percpu = !(wq->flags & WQ_UNBOUND);
|
||||||
|
#else
|
||||||
|
bool percpu = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (percpu)
|
||||||
free_percpu(wq->cpu_wq.pcpu);
|
free_percpu(wq->cpu_wq.pcpu);
|
||||||
else if (wq->cpu_wq.single) {
|
else if (wq->cpu_wq.single) {
|
||||||
/* the pointer to free is stored right after the cwq */
|
/* the pointer to free is stored right after the cwq */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue