[PATCH] coredump_wait() cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch deletes pointless (please correct me if I am wrong)
code from coredump_wait().

1. It does useless mm->core_waiters inc/dec under mm->mmap_sem,
   but any changes to ->core_waiters have no effect until we drop
   ->mmap_sem.

2. It calls yield() for absolutely unknown reason.

Signed-off-by: Oleg Nesterov <[email protected]>

--- 2.6.14-rc3/fs/exec.c~	2005-09-21 21:08:33.000000000 +0400
+++ 2.6.14-rc3/fs/exec.c	2005-10-09 23:54:45.000000000 +0400
@@ -1422,19 +1422,16 @@ static void zap_threads (struct mm_struc
 static void coredump_wait(struct mm_struct *mm)
 {
 	DECLARE_COMPLETION(startup_done);
-
-	mm->core_waiters++; /* let other threads block */
-	mm->core_startup_done = &startup_done;
-
-	/* give other threads a chance to run: */
-	yield();
-
-	zap_threads(mm);
-	if (--mm->core_waiters) {
-		up_write(&mm->mmap_sem);
-		wait_for_completion(&startup_done);
-	} else
-		up_write(&mm->mmap_sem);
+	int core_waiters;
+
+	mm->core_startup_done = &startup_done;
+
+	zap_threads(mm);
+	core_waiters = mm->core_waiters;
+	up_write(&mm->mmap_sem);
+
+	if (core_waiters)
+		wait_for_completion(&startup_done);
 	BUG_ON(mm->core_waiters);
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux