Skip to content

Commit b188c57

Browse files
mbrost05htejun
authored andcommitted
workqueue: Split alloc_workqueue into internal function and lockdep init
Will help enable user-defined lockdep maps for workqueues. Cc: Tejun Heo <[email protected]> Cc: Lai Jiangshan <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 946c57e commit b188c57

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

kernel/workqueue.c

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5612,9 +5612,9 @@ static void wq_adjust_max_active(struct workqueue_struct *wq)
56125612
}
56135613

56145614
__printf(1, 4)
5615-
struct workqueue_struct *alloc_workqueue(const char *fmt,
5616-
unsigned int flags,
5617-
int max_active, ...)
5615+
static struct workqueue_struct *__alloc_workqueue(const char *fmt,
5616+
unsigned int flags,
5617+
int max_active, ...)
56185618
{
56195619
va_list args;
56205620
struct workqueue_struct *wq;
@@ -5680,12 +5680,11 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
56805680
INIT_LIST_HEAD(&wq->flusher_overflow);
56815681
INIT_LIST_HEAD(&wq->maydays);
56825682

5683-
wq_init_lockdep(wq);
56845683
INIT_LIST_HEAD(&wq->list);
56855684

56865685
if (flags & WQ_UNBOUND) {
56875686
if (alloc_node_nr_active(wq->node_nr_active) < 0)
5688-
goto err_unreg_lockdep;
5687+
goto err_free_wq;
56895688
}
56905689

56915690
/*
@@ -5724,9 +5723,6 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
57245723
kthread_flush_worker(pwq_release_worker);
57255724
free_node_nr_active(wq->node_nr_active);
57265725
}
5727-
err_unreg_lockdep:
5728-
wq_unregister_lockdep(wq);
5729-
wq_free_lockdep(wq);
57305726
err_free_wq:
57315727
free_workqueue_attrs(wq->unbound_attrs);
57325728
kfree(wq);
@@ -5737,6 +5733,25 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
57375733
destroy_workqueue(wq);
57385734
return NULL;
57395735
}
5736+
5737+
__printf(1, 4)
5738+
struct workqueue_struct *alloc_workqueue(const char *fmt,
5739+
unsigned int flags,
5740+
int max_active, ...)
5741+
{
5742+
struct workqueue_struct *wq;
5743+
va_list args;
5744+
5745+
va_start(args, max_active);
5746+
wq = __alloc_workqueue(fmt, flags, max_active, args);
5747+
va_end(args);
5748+
if (!wq)
5749+
return NULL;
5750+
5751+
wq_init_lockdep(wq);
5752+
5753+
return wq;
5754+
}
57405755
EXPORT_SYMBOL_GPL(alloc_workqueue);
57415756

57425757
static bool pwq_busy(struct pool_workqueue *pwq)

0 commit comments

Comments
 (0)