|
From: Paul P. <ppl...@gm...> - 2005-02-15 01:19:11
|
Greetings,
A trivial test case that spins 2 CPU-bound threads on a dual-processor machine.
Using VG-2.2, I observe one CPU to be pegged at 99.9%, the other idle
(as I expected).
Using VG-2.3 from CVS (snapshot on Feb 07, 2005), I observe both CPUs
at 49.9% load. This probably means that the threads are competing for
a single valgrind lock (since the spin is in "while (1) { x += 1; }"
code, there could not be any other locks, I think).
This is happening even with '--tool=none' and for any number of threads >= 2.
Was that expected behaviour?
Thanks,
|
|
From: Tom H. <to...@co...> - 2005-02-15 09:48:07
|
In message <2a2...@ma...>
Paul Pluzhnikov <ppl...@gm...> wrote:
> Using VG-2.2, I observe one CPU to be pegged at 99.9%, the other idle
> (as I expected).
> Using VG-2.3 from CVS (snapshot on Feb 07, 2005), I observe both CPUs
> at 49.9% load. This probably means that the threads are competing for
> a single valgrind lock (since the spin is in "while (1) { x += 1; }"
> code, there could not be any other locks, I think).
This sounds correct. Previously all the code was run in one kernel
thread no matter what thread it came from, so it would all tend to
run on one processor.
We now use one kernel thread for each thread in the program, but only
one thread is allowed to run at a time to keep the shared state used
by valgrind safe. The result is that you will still only use about
one whole CPU in total, but it may be spread over the available CPUs
as you have seen.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|