Re: X86_64 Ctx switch times - 32bit vs 64bit

From: Andi Kleen
Date: Sat May 07 2005 - 09:42:02 EST


Parag Warudkar <kernel-stuff@xxxxxxxxxxx> writes:

> I was experimenting with the attached program (taken from an IBM
> Developerworks article) to find the context switch times on AMD64 machine.
>
> With a 64bit binary I get average 5 to 8 usec/cswitch, whereas the same
> program compiled as 32bit consistently gives >= 10 usec/cswitch - sometimes
> even 13 usec/cswitch.
>
> Are there more context switching overheads when running 32bit programs on a
> 64bit kernel?

Should be nearly the same in theory, no. This means 32bit programs use %gs
as thread register which is a bit more costly to switch because
the kernel uses it internally too, but the difference should be less
than that.

I suspect your program is more testing the locks anyways, perhaps
there is some other difference in the glibc. e.g. 32bit glibc compiled
for pre 686 CPUs has slower locks.

oprofile might provide more clue where the overhead is.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/