mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Roland McGrath <roland@redhat.com>,
	Andrew Morton <akpm@osdl.org>
Subject: [PATCH] coredump_wait() cleanup
Date: Sun, 09 Oct 2005 20:21:57 +0400	[thread overview]
Message-ID: <434943A5.BD5440AC@tv-sign.ru> (raw)

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 <oleg@tv-sign.ru>

--- 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);
 }

                 reply	other threads:[~2005-10-09 16:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=434943A5.BD5440AC@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®