diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpuset.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 407b5f0a8c8e..79866bc6b3a1 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -180,6 +180,8 @@ static struct super_block *cpuset_sb = NULL; | |||
180 | */ | 180 | */ |
181 | 181 | ||
182 | static DECLARE_MUTEX(cpuset_sem); | 182 | static DECLARE_MUTEX(cpuset_sem); |
183 | static struct task_struct *cpuset_sem_owner; | ||
184 | static int cpuset_sem_depth; | ||
183 | 185 | ||
184 | /* | 186 | /* |
185 | * The global cpuset semaphore cpuset_sem can be needed by the | 187 | * The global cpuset semaphore cpuset_sem can be needed by the |
@@ -200,16 +202,19 @@ static DECLARE_MUTEX(cpuset_sem); | |||
200 | 202 | ||
201 | static inline void cpuset_down(struct semaphore *psem) | 203 | static inline void cpuset_down(struct semaphore *psem) |
202 | { | 204 | { |
203 | if (current->cpuset_sem_nest_depth == 0) | 205 | if (cpuset_sem_owner != current) { |
204 | down(psem); | 206 | down(psem); |
205 | current->cpuset_sem_nest_depth++; | 207 | cpuset_sem_owner = current; |
208 | } | ||
209 | cpuset_sem_depth++; | ||
206 | } | 210 | } |
207 | 211 | ||
208 | static inline void cpuset_up(struct semaphore *psem) | 212 | static inline void cpuset_up(struct semaphore *psem) |
209 | { | 213 | { |
210 | current->cpuset_sem_nest_depth--; | 214 | if (--cpuset_sem_depth == 0) { |
211 | if (current->cpuset_sem_nest_depth == 0) | 215 | cpuset_sem_owner = NULL; |
212 | up(psem); | 216 | up(psem); |
217 | } | ||
213 | } | 218 | } |
214 | 219 | ||
215 | /* | 220 | /* |