Skip to contentSkip to conversation

cpuset - fix return without releasing semaphore

PATCH In review [email protected] 2 participants 3 messages Nov 12, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuset - fix return without releasing semaphore

It seems wrong to acquire the semaphore and then return from cpuset_zone_allowed without releasing it. This was only compile tested.

bob

 kernel/cpuset.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
kernel/cpuset.c +3 -2
Index: linux-2.6.14-mm1/kernel/cpuset.c
===================================================================
@@ -2036,11 +2036,12 @@ int cpuset_zone_allowed(struct zone *z, 
 	if (gfp_mask & __GFP_HARDWALL)	/* If hardwall request, stop here */
 		return 0;
 
+	if (current->flags & PF_EXITING) /* Let dying task have memory */
+		return 1;
+
 	/* Not hardwall and node outside mems_allowed: scan up cpusets */
 	down(&callback_sem);
 
-	if (current->flags & PF_EXITING) /* Let dying task have memory */
-		return 1;
 	task_lock(current);
 	cs = nearest_exclusive_ancestor(current->cpuset);
 	task_unlock(current);
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Bob

It seems wrong to acquire the semaphore and then return from cpuset_zone_allowed without releasing it. This was only compile tested.

Nice catch, Bob. Thanks.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
#2 lore raw
In reply to [email protected]
Quoted 1 line

This was only compile tested.

I boot, function and stress tested it on an ia64 SN2 system. As expected, works fine, just as it did before.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401