From: Ernie Petrides <petrides@redhat.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: 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 02:52:44 -0400 [thread overview]
Message-ID: <200310130652.h9D6qiib005952@pasta.boston.redhat.com> (raw)
In-Reply-To: Your message of "Thu, 09 Oct 2003 17:25:52 -0300."
On Thursday, 9-Oct-2003 at 17:25 -0300, Marcelo Tosatti wrote:
> BTW, further performance testing of the removal of this optimization is
> VERY welcome.
>
> I've done some tests and no big performance harm has showed up, but thats
> just me.
In a variation of a (loosely) 2.4.21-based kernel, I get a 0% degradation
in the speed of a program exec'ing itself 1,000,000 times with the addition
of the missing locking in exec_mmap():
--- 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;
}
Applying your change to the same kernel, I get a 2.5% degradation in the
same test case:
--- linux-2.4.21/fs/exec.c.orig
+++ linux-2.4.21/fs/exec.c
@@ -451,12 +451,6 @@ static int exec_mmap(void)
struct mm_struct * mm, * old_mm;
old_mm = current->mm;
- if (old_mm && atomic_read(&old_mm->mm_users) == 1) {
- mm_release();
- exit_aio(old_mm);
- exit_mmap(old_mm);
- return 0;
- }
mm = mm_alloc();
if (mm) {
Average times over 3 runs (of 1,000,000 execs each) were:
base kernel: 529 elapsed seconds
w/1st change: 529 elapsed seconds
w/2nd change: 542 elapsed seconds
I wouldn't bother optimizing for an exec() syscall, but the 1st change
also eliminates the possibility of two ENOMEM error paths in the typical
case of not sharing an mm_struct.
Also, a reproducer that could expose the race condition (in typically 5-20
seconds) on a dual-Xeon Dell box ran for 10's of minutes without problems
with either fix.
Cheers. -ernie
next reply other threads:[~2003-10-13 6:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-13 6:52 Ernie Petrides [this message]
2003-10-13 12:09 ` Andrea Arcangeli
-- 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=200310130652.h9D6qiib005952@pasta.boston.redhat.com \
--to=petrides@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=marcelo.tosatti@cyclades.com.br \
--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
all inboxes | Powered by JetHome®