public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Ernie Petrides <petrides@redhat.com>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Dave Kleikamp <shaggy@austin.ibm.com>,
	Marcelo Tosatti <marcelo.tosatti@cyclades.com.br>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.4.x performance tests Re: [PATCH] BUG() in exec_mmap()
Date: Mon, 13 Oct 2003 14:09:36 +0200	[thread overview]
Message-ID: <20031013120936.GF1887@velociraptor.random> (raw)
In-Reply-To: <200310130652.h9D6qiib005952@pasta.boston.redhat.com>

On Mon, Oct 13, 2003 at 02:52:44AM -0400, Ernie Petrides wrote:
> --- linux-2.4.21/fs/exec.c.orig
> +++ linux-2.4.21/fs/exec.c
> @@ -452,9 +452,11 @@ static int exec_mmap(void)
>  
>  	old_mm = current->mm;
>  	if (old_mm && atomic_read(&old_mm->mm_users) == 1) {
> +		down_write(&old_mm->mmap_sem);
>  		mm_release();
>  		exit_aio(old_mm);
>  		exit_mmap(old_mm);
> +		up_write(&old_mm->mmap_sem);
>  		return 0;
>  	}

Is there any special reason you take it around mm_release and exit_aio
too? I don't feel this is needed. exit_aio btw still assumes nobody can
race, so it doesn't take any spinlock (brlocks actually) to guard
against other aio threads, I believe that's ok since as worse the other
tasks can mangle the vm with ptrace, they'll never get to mess with aio,
only the current task can and the mm_user == 1 check guarantees we've no
sibiling threads. the mmap_sem shouldn't help exit_aio anyways, if
something it'll make it deadlock if there's any access to the VM that
generates a page fault in the cancel() callback.

So I suggest this sequence should be safe:

	mm_release();
	exit_aio(old_mm);

	down_write(&old_mm->mmap_sem);
	exit_mmap(old_mm);
	up_write(&old_mm->mmap_sem);

Please double check ;)

Andrea - If you prefer relying on open source software, check these links:
	    rsync.kernel.org::pub/scm/linux/kernel/bkcvs/linux-2.[45]/
	    http://www.cobite.com/cvsps/

  reply	other threads:[~2003-10-13 12:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-13  6:52 2.4.x performance tests Re: [PATCH] BUG() in exec_mmap() Ernie Petrides
2003-10-13 12:09 ` Andrea Arcangeli [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-10-09 20:19 Marcelo Tosatti
2003-10-09 20:25 ` 2.4.x performance tests " Marcelo Tosatti

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=20031013120936.GF1887@velociraptor.random \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=marcelo.tosatti@cyclades.com.br \
    --cc=petrides@redhat.com \
    --cc=shaggy@austin.ibm.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