Skip to contentSkip to conversation

cpuset fork locking fix

PATCH New Paul Jackson 1 participant 1 message Nov 26, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuset fork locking fix

Move the cpuset_fork() call below the write_unlock_irq call in kernel/fork.c copy_process().

Since the cpuset-dual-semaphore-locking-overhaul.patch, the cpuset_fork() routine acquires task_lock(), so cannot be called while holding the tasklist_lock for write.

---

 kernel/fork.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
kernel/fork.c +1 -2
@@ -1131,8 +1131,6 @@ static task_t *copy_process(unsigned lon
 	if (unlikely(p->ptrace & PT_PTRACED))
 		__ptrace_link(p, current->parent);
 
-	cpuset_fork(p);
-
 	attach_pid(p, PIDTYPE_PID, p->pid);
 	attach_pid(p, PIDTYPE_TGID, p->tgid);
 	if (thread_group_leader(p)) {
@@ -1149,6 +1147,7 @@ static task_t *copy_process(unsigned lon
 	nr_threads++;
 	total_forks++;
 	write_unlock_irq(&tasklist_lock);
+	cpuset_fork(p);
 	retval = 0;
 
 fork_out:
Signature · 3 lines
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <[email protected]> 1.650.933.1373