Skip to content

Commit c2a6c84

Browse files
author
Robert Foss
committed
workqueue: Change workqueue lockdep map to pointer
JIRA: https://issues.redhat.com/browse/RHEL-53569 Upstream Status: v6.12-rc1 commit 4f022f4 Author: Matthew Brost <matthew.brost@intel.com> AuthorDate: Fri Aug 9 15:28:24 2024 -0700 Commit: Tejun Heo <tj@kernel.org> CommitDate: Tue Aug 13 09:05:40 2024 -1000 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> Signed-off-by: Robert Foss <rfoss@redhat.com>
1 parent 461cd6a commit c2a6c84

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

@@ -3243,7 +3244,7 @@ __acquires(&pool->lock)
32433244
lockdep_start_depth = lockdep_depth(current);
32443245
/* see drain_dead_softirq_workfn() */
32453246
if (!bh_draining)
3246-
lock_map_acquire(&pwq->wq->lockdep_map);
3247+
lock_map_acquire(pwq->wq->lockdep_map);
32473248
lock_map_acquire(&lockdep_map);
32483249
/*
32493250
* Strictly speaking we should mark the invariant state without holding
@@ -3277,7 +3278,7 @@ __acquires(&pool->lock)
32773278
pwq->stats[PWQ_STAT_COMPLETED]++;
32783279
lock_map_release(&lockdep_map);
32793280
if (!bh_draining)
3280-
lock_map_release(&pwq->wq->lockdep_map);
3281+
lock_map_release(pwq->wq->lockdep_map);
32813282

32823283
if (unlikely((worker->task && in_atomic()) ||
32833284
lockdep_depth(current) != lockdep_start_depth ||
@@ -3915,8 +3916,8 @@ static void touch_wq_lockdep_map(struct workqueue_struct *wq)
39153916
if (wq->flags & WQ_BH)
39163917
local_bh_disable();
39173918

3918-
lock_map_acquire(&wq->lockdep_map);
3919-
lock_map_release(&wq->lockdep_map);
3919+
lock_map_acquire(wq->lockdep_map);
3920+
lock_map_release(wq->lockdep_map);
39203921

39213922
if (wq->flags & WQ_BH)
39223923
local_bh_enable();
@@ -3950,7 +3951,7 @@ void __flush_workqueue(struct workqueue_struct *wq)
39503951
struct wq_flusher this_flusher = {
39513952
.list = LIST_HEAD_INIT(this_flusher.list),
39523953
.flush_color = -1,
3953-
.done = COMPLETION_INITIALIZER_ONSTACK_MAP(this_flusher.done, wq->lockdep_map),
3954+
.done = COMPLETION_INITIALIZER_ONSTACK_MAP(this_flusher.done, (*wq->lockdep_map)),
39543955
};
39553956
int next_color;
39563957

@@ -4664,7 +4665,8 @@ static void wq_init_lockdep(struct workqueue_struct *wq)
46644665
lock_name = wq->name;
46654666

46664667
wq->lock_name = lock_name;
4667-
lockdep_init_map(&wq->lockdep_map, lock_name, &wq->key, 0);
4668+
wq->lockdep_map = &wq->__lockdep_map;
4669+
lockdep_init_map(wq->lockdep_map, lock_name, &wq->key, 0);
46684670
}
46694671

46704672
static void wq_unregister_lockdep(struct workqueue_struct *wq)

0 commit comments

Comments
 (0)