mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Roland McGrath <roland@redhat.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] coredump: turn mm->core_startup_done into the pointer to struct core_state
Date: Sat, 28 Jun 2008 17:17:16 +0400	[thread overview]
Message-ID: <20080628131716.GA4409@tv-sign.ru> (raw)

mm->core_startup_done points to "struct completion startup_done" allocated on
the coredump_wait()'s stack. Introduce the new structure, core_state, which
holds this "struct completion". This way we can add more info visible to the
threads participating in coredump without enlarging mm_struct.

No changes in affected .o files.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

 include/linux/mm_types.h |    7 ++++++-
 kernel/exit.c            |    2 +-
 fs/exec.c                |    8 ++++----
 3 files changed, 11 insertions(+), 6 deletions(-)

--- 26-rc2/include/linux/mm_types.h~1_MM_COREDUMP	2008-06-14 16:38:07.000000000 +0400
+++ 26-rc2/include/linux/mm_types.h	2008-06-15 14:23:40.000000000 +0400
@@ -159,6 +159,10 @@ struct vm_area_struct {
 #endif
 };
 
+struct core_state {
+	struct completion startup;
+};
+
 struct mm_struct {
 	struct vm_area_struct * mmap;		/* list of VMAs */
 	struct rb_root mm_rb;
@@ -220,7 +224,8 @@ struct mm_struct {
 	unsigned long flags; /* Must use atomic bitops to access the bits */
 
 	/* coredumping support */
-	struct completion *core_startup_done, core_done;
+	struct core_state *core_state;
+	struct completion core_done;
 
 	/* aio bits */
 	rwlock_t		ioctx_list_lock;	/* aio lock */
--- 26-rc2/kernel/exit.c~1_MM_COREDUMP	2008-05-31 20:08:11.000000000 +0400
+++ 26-rc2/kernel/exit.c	2008-06-15 14:24:35.000000000 +0400
@@ -669,7 +669,7 @@ static void exit_mm(struct task_struct *
 		up_read(&mm->mmap_sem);
 		down_write(&mm->mmap_sem);
 		if (!--mm->core_waiters)
-			complete(mm->core_startup_done);
+			complete(&mm->core_state->startup);
 		up_write(&mm->mmap_sem);
 
 		wait_for_completion(&mm->core_done);
--- 26-rc2/fs/exec.c~1_MM_COREDUMP	2008-06-14 15:57:27.000000000 +0400
+++ 26-rc2/fs/exec.c	2008-06-15 14:25:44.000000000 +0400
@@ -1592,13 +1592,13 @@ static int coredump_wait(int exit_code)
 {
 	struct task_struct *tsk = current;
 	struct mm_struct *mm = tsk->mm;
-	struct completion startup_done;
+	struct core_state core_state;
 	struct completion *vfork_done;
 	int core_waiters;
 
 	init_completion(&mm->core_done);
-	init_completion(&startup_done);
-	mm->core_startup_done = &startup_done;
+	init_completion(&core_state.startup);
+	mm->core_state = &core_state;
 
 	core_waiters = zap_threads(tsk, mm, exit_code);
 	up_write(&mm->mmap_sem);
@@ -1617,7 +1617,7 @@ static int coredump_wait(int exit_code)
 	}
 
 	if (core_waiters)
-		wait_for_completion(&startup_done);
+		wait_for_completion(&core_state.startup);
 fail:
 	BUG_ON(mm->core_waiters);
 	return core_waiters;


             reply	other threads:[~2008-06-28 13:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-28 13:17 Oleg Nesterov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-07-06 15:22 Oleg Nesterov
2008-06-16 16:31 Oleg Nesterov

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=20080628131716.GA4409@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --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®