mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
workqueue: Split alloc_workqueue into internal function and lockdep init
Will help enable user-defined lockdep maps for workqueues. Cc: Tejun Heo <tj@kernel.org> Cc: Lai Jiangshan <jiangshanlai@gmail.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
@@ -5612,9 +5612,9 @@ static void wq_adjust_max_active(struct workqueue_struct *wq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
__printf(1, 4)
|
__printf(1, 4)
|
||||||
struct workqueue_struct *alloc_workqueue(const char *fmt,
|
static struct workqueue_struct *__alloc_workqueue(const char *fmt,
|
||||||
unsigned int flags,
|
unsigned int flags,
|
||||||
int max_active, ...)
|
int max_active, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
struct workqueue_struct *wq;
|
struct workqueue_struct *wq;
|
||||||
@@ -5680,12 +5680,11 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
|
|||||||
INIT_LIST_HEAD(&wq->flusher_overflow);
|
INIT_LIST_HEAD(&wq->flusher_overflow);
|
||||||
INIT_LIST_HEAD(&wq->maydays);
|
INIT_LIST_HEAD(&wq->maydays);
|
||||||
|
|
||||||
wq_init_lockdep(wq);
|
|
||||||
INIT_LIST_HEAD(&wq->list);
|
INIT_LIST_HEAD(&wq->list);
|
||||||
|
|
||||||
if (flags & WQ_UNBOUND) {
|
if (flags & WQ_UNBOUND) {
|
||||||
if (alloc_node_nr_active(wq->node_nr_active) < 0)
|
if (alloc_node_nr_active(wq->node_nr_active) < 0)
|
||||||
goto err_unreg_lockdep;
|
goto err_free_wq;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5724,9 +5723,6 @@ err_unlock_free_node_nr_active:
|
|||||||
kthread_flush_worker(pwq_release_worker);
|
kthread_flush_worker(pwq_release_worker);
|
||||||
free_node_nr_active(wq->node_nr_active);
|
free_node_nr_active(wq->node_nr_active);
|
||||||
}
|
}
|
||||||
err_unreg_lockdep:
|
|
||||||
wq_unregister_lockdep(wq);
|
|
||||||
wq_free_lockdep(wq);
|
|
||||||
err_free_wq:
|
err_free_wq:
|
||||||
free_workqueue_attrs(wq->unbound_attrs);
|
free_workqueue_attrs(wq->unbound_attrs);
|
||||||
kfree(wq);
|
kfree(wq);
|
||||||
@@ -5737,6 +5733,25 @@ err_destroy:
|
|||||||
destroy_workqueue(wq);
|
destroy_workqueue(wq);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__printf(1, 4)
|
||||||
|
struct workqueue_struct *alloc_workqueue(const char *fmt,
|
||||||
|
unsigned int flags,
|
||||||
|
int max_active, ...)
|
||||||
|
{
|
||||||
|
struct workqueue_struct *wq;
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, max_active);
|
||||||
|
wq = __alloc_workqueue(fmt, flags, max_active, args);
|
||||||
|
va_end(args);
|
||||||
|
if (!wq)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
wq_init_lockdep(wq);
|
||||||
|
|
||||||
|
return wq;
|
||||||
|
}
|
||||||
EXPORT_SYMBOL_GPL(alloc_workqueue);
|
EXPORT_SYMBOL_GPL(alloc_workqueue);
|
||||||
|
|
||||||
static bool pwq_busy(struct pool_workqueue *pwq)
|
static bool pwq_busy(struct pool_workqueue *pwq)
|
||||||
|
|||||||
Reference in New Issue
Block a user