Skip to content

Commit 4f022f4

Browse files
mbrost05htejun
authored andcommitted
workqueue: Change workqueue lockdep map to pointer
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 b188c57 commit 4f022f4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

kernel/workqueue.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ struct workqueue_struct {
364364
#ifdef CONFIG_LOCKDEP
365365
char *lock_name;
366366
struct lock_class_key key;
367-
struct lockdep_map lockdep_map;
367+
struct lockdep_map __lockdep_map;
368+
struct lockdep_map *lockdep_map;
368369
#endif
369370
char name[WQ_NAME_LEN]; /* I: workqueue name */
370371

@@ -3203,7 +3204,7 @@ __acquires(&pool->lock)
32033204
lockdep_start_depth = lockdep_depth(current);
32043205
/* see drain_dead_softirq_workfn() */
32053206
if (!bh_draining)
3206-
lock_map_acquire(&pwq->wq->lockdep_map);
3207+
lock_map_acquire(pwq->wq->lockdep_map);
32073208
lock_map_acquire(&lockdep_map);
32083209
/*
32093210
* Strictly speaking we should mark the invariant state without holding
@@ -3237,7 +3238,7 @@ __acquires(&pool->lock)
32373238
pwq->stats[PWQ_STAT_COMPLETED]++;
32383239
lock_map_release(&lockdep_map);
32393240
if (!bh_draining)
3240-
lock_map_release(&pwq->wq->lockdep_map);
3241+
lock_map_release(pwq->wq->lockdep_map);
32413242

32423243
if (unlikely((worker->task && in_atomic()) ||
32433244
lockdep_depth(current) != lockdep_start_depth ||
@@ -3873,8 +3874,8 @@ static void touch_wq_lockdep_map(struct workqueue_struct *wq)
38733874
if (wq->flags & WQ_BH)
38743875
local_bh_disable();
38753876

3876-
lock_map_acquire(&wq->lockdep_map);
3877-
lock_map_release(&wq->lockdep_map);
3877+
lock_map_acquire(wq->lockdep_map);
3878+
lock_map_release(wq->lockdep_map);
38783879

38793880
if (wq->flags & WQ_BH)
38803881
local_bh_enable();
@@ -3908,7 +3909,7 @@ void __flush_workqueue(struct workqueue_struct *wq)
39083909
struct wq_flusher this_flusher = {
39093910
.list = LIST_HEAD_INIT(this_flusher.list),
39103911
.flush_color = -1,
3911-
.done = COMPLETION_INITIALIZER_ONSTACK_MAP(this_flusher.done, wq->lockdep_map),
3912+
.done = COMPLETION_INITIALIZER_ONSTACK_MAP(this_flusher.done, (*wq->lockdep_map)),
39123913
};
39133914
int next_color;
39143915

@@ -4768,7 +4769,8 @@ static void wq_init_lockdep(struct workqueue_struct *wq)
47684769
lock_name = wq->name;
47694770

47704771
wq->lock_name = lock_name;
4771-
lockdep_init_map(&wq->lockdep_map, lock_name, &wq->key, 0);
4772+
wq->lockdep_map = &wq->__lockdep_map;
4773+
lockdep_init_map(wq->lockdep_map, lock_name, &wq->key, 0);
47724774
}
47734775

47744776
static void wq_unregister_lockdep(struct workqueue_struct *wq)

0 commit comments

Comments
 (0)