Skip to content

Commit 14c11e1

Browse files
Chen Ridonghtejun
authored andcommitted
cpuset: add lockdep_assert_cpuset_lock_held helper
Add lockdep_assert_cpuset_lock_held() to allow other subsystems to verify that cpuset_mutex is held. Suggested-by: Waiman Long <longman@redhat.com> Signed-off-by: Chen Ridong <chenridong@huawei.com> Reviewed-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 6ee4304 commit 14c11e1

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

include/linux/cpuset.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ extern void inc_dl_tasks_cs(struct task_struct *task);
7474
extern void dec_dl_tasks_cs(struct task_struct *task);
7575
extern void cpuset_lock(void);
7676
extern void cpuset_unlock(void);
77+
extern void lockdep_assert_cpuset_lock_held(void);
7778
extern void cpuset_cpus_allowed_locked(struct task_struct *p, struct cpumask *mask);
7879
extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
7980
extern bool cpuset_cpus_allowed_fallback(struct task_struct *p);
@@ -195,6 +196,7 @@ static inline void inc_dl_tasks_cs(struct task_struct *task) { }
195196
static inline void dec_dl_tasks_cs(struct task_struct *task) { }
196197
static inline void cpuset_lock(void) { }
197198
static inline void cpuset_unlock(void) { }
199+
static inline void lockdep_assert_cpuset_lock_held(void) { }
198200

199201
static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
200202
struct cpumask *mask)

kernel/cgroup/cpuset.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ void cpuset_unlock(void)
271271
mutex_unlock(&cpuset_mutex);
272272
}
273273

274+
void lockdep_assert_cpuset_lock_held(void)
275+
{
276+
lockdep_assert_held(&cpuset_mutex);
277+
}
278+
274279
/**
275280
* cpuset_full_lock - Acquire full protection for cpuset modification
276281
*

0 commit comments

Comments
 (0)