Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261322AbVEGOkR (ORCPT ); Sat, 7 May 2005 10:40:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261333AbVEGOkR (ORCPT ); Sat, 7 May 2005 10:40:17 -0400 Received: from one.firstfloor.org ([213.235.205.2]:28136 "EHLO one.firstfloor.org") by vger.kernel.org with ESMTP id S261322AbVEGOkM (ORCPT ); Sat, 7 May 2005 10:40:12 -0400 To: Parag Warudkar Cc: linux-kernel@vger.kernel.org Subject: Re: X86_64 Ctx switch times - 32bit vs 64bit References: <200505052138.57821.kernel-stuff@comcast.net> From: Andi Kleen Date: Sat, 07 May 2005 16:40:07 +0200 In-Reply-To: <200505052138.57821.kernel-stuff@comcast.net> (Parag Warudkar's message of "Thu, 5 May 2005 21:38:57 -0400") Message-ID: User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1174 Lines: 29 Parag Warudkar 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/