From: Peter Zijlstra <peterz@infradead.org>
To: edwin <edwintorok@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
rml@tech9.net, Linux Kernel <linux-kernel@vger.kernel.org>,
"Thomas Gleixner mingo@redhat.com" <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: Quad core CPUs loaded at only 50% when running a CPU and mmap intensive multi-threaded task
Date: Mon, 25 Aug 2008 11:23:10 +0200 [thread overview]
Message-ID: <1219656190.8515.7.camel@twins> (raw)
In-Reply-To: <48B25988.8040302@gmail.com>
On Mon, 2008-08-25 at 10:04 +0300, edwin wrote:
> Peter Zijlstra wrote:
> > On Mon, 2008-08-25 at 00:01 +0300, Török Edwin wrote:
> >
> >> Hi Ingo,
> >>
> >> When I run clamd (www.clamav.net), I can only get to load my CPU 50%
> >> (according to top), and disks at 30% (according to iostat -x 3),
> >> regardless how many threads I set (I tried 4, 8, 16, 32).
> >>
> >
> >
> > Can you share your .config, and prehaps tell what kernel version did
> > work for you?
>
> Sorry, I forgot to include the .config, its at the end of this mail (the
> cfs debug info output included the .config though)
>
> Well, I just bought this new box, so there isn't a kernel version that I
> know that worked on this hardware (but I am trying to boot some older
> versions now).
> However on my previous box (Athlon64, non-SMP) I have never seen such a
> problem (that the CPU is loaded only 50% with clamd) and I've been
> running 2.6.26 and 2.6.27-rc4 there too.
>
> Details below, short summary here:
> 2.6.24: WORKS, clamd 400% CPU, testprogram runs in 27.4 seconds, 67% CPU
> load; and 28.5 seconds w/o setting affinity
> 2.6.25+: DOES NOT WORK, clamd 200%-300% CPU, testprogram runs in 38-40
> seconds, 48-48% CPU load, and 47-56 seconds w/o setting affinity
>
> Debian has 2.6.18, 2.6.22, 2.6.24, 2.6.25, 2.6.26.
> 2.6.22 won't work with my lvm, so I can't boot that, so I tried 2.6.24:
>
> 2.6.24 doesn't have sched_debug enabled in the stock kernel
> unfortunately, but the output of cfs-debug-info.sh is available here,
> maybe it contains some useful info:
> http://edwintorok.googlepages.com/testrun-1219645937.tar.gz
>
> Is this enough info for you to reproduce the problem, or do you want me
> to try and bisect?
No, I think I know what's going on..
mmap() and munmap() need to take the mmap_sem for writing (since they
modify the memory map) and you let each thread (one for each cpu) take
that process wide lock, twice, for a million times.
Guess what happens ;-)
next prev parent reply other threads:[~2008-08-25 9:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <48B1CC15.2040006@gmail.com>
2008-08-25 5:51 ` Quad core CPUs loaded at only 50% when running a CPU and mmap intensive multi-threaded task Peter Zijlstra
2008-08-25 7:04 ` edwin
2008-08-25 9:23 ` Peter Zijlstra [this message]
2008-08-25 9:49 ` Török Edwin
2008-08-25 10:02 ` Peter Zijlstra
2008-08-25 10:22 ` Török Edwin
2008-08-25 10:36 ` Peter Zijlstra
2008-08-25 11:00 ` edwin
2008-08-25 11:30 ` edwin
2008-08-25 11:41 ` Peter Zijlstra
2008-08-25 13:48 ` Theodore Tso
2008-08-26 8:12 ` Andi Kleen
2008-09-08 19:10 ` Török Edwin
2008-09-12 19:16 ` mmap/munmap latency on multithreaded apps, because pagefaults hold mmap_sem during disk read Török Edwin
2008-09-12 19:35 ` Mike Waychison
2008-09-12 20:10 ` Török Edwin
2008-08-25 10:37 ` Quad core CPUs loaded at only 50% when running a CPU and mmap intensive multi-threaded task Peter Zijlstra
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=1219656190.8515.7.camel@twins \
--to=peterz@infradead.org \
--cc=edwintorok@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rml@tech9.net \
--cc=tglx@linutronix.de \
/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