Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933322Ab2KEV4b (ORCPT ); Mon, 5 Nov 2012 16:56:31 -0500 Received: from mga09.intel.com ([134.134.136.24]:58956 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932222Ab2KEV43 (ORCPT ); Mon, 5 Nov 2012 16:56:29 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,716,1344236400"; d="scan'208";a="215518284" Message-ID: <5098360C.6090805@intel.com> Date: Mon, 05 Nov 2012 13:56:28 -0800 From: Alexander Duyck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: "Kirill A. Shutemov" CC: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, andi@firstfloor.org, linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v3 1/8] x86: Improve __phys_addr performance by making use of carry flags and inlining References: <20121105185657.10205.27419.stgit@gitlad.jf.intel.com> <20121105190332.10205.22300.stgit@gitlad.jf.intel.com> <20121105202425.GA25671@shutemov.name> In-Reply-To: <20121105202425.GA25671@shutemov.name> X-Enigmail-Version: 1.4.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2983 Lines: 54 On 11/05/2012 12:24 PM, Kirill A. Shutemov wrote: > On Mon, Nov 05, 2012 at 11:04:06AM -0800, Alexander Duyck wrote: >> This patch is meant to improve overall system performance when making use of >> the __phys_addr call. To do this I have implemented several changes. >> >> First if CONFIG_DEBUG_VIRTUAL is not defined __phys_addr is made an inline, >> similar to how this is currently handled in 32 bit. However in order to do >> this it is required to export phys_base so that it is available if __phys_addr >> is used in kernel modules. >> >> The second change was to streamline the code by making use of the carry flag >> on an add operation instead of performing a compare on a 64 bit value. The >> advantage to this is that it allows us to significantly reduce the overall >> size of the call. On my Xeon E5 system the entire __phys_addr inline call >> consumes a little less than 32 bytes and 5 instructions. I also applied >> similar logic to the debug version of the function. My testing shows that the >> debug version of the function with this patch applied is slightly faster than >> the non-debug version without the patch. >> >> When building the kernel with the first two changes applied I saw build >> warnings about __START_KERNEL_map and PAGE_OFFSET constants not fitting in >> their type. In order to resolve the build warning I changed their type from >> UL to ULL. > What kind of warning messages did you see? > It's strange: sizeof(unsinged long) == sizeof(unsinged long long) on > x86_64 One of the warnings is included below: In file included from /usr/src/kernels/linux-next/arch/x86/include/asm/page_types.h:37, from /usr/src/kernels/linux-next/arch/x86/include/asm/pgtable_types.h:5, from /usr/src/kernels/linux-next/arch/x86/include/asm/boot.h:11, from arch/x86/realmode/rm/../../boot/boot.h:26, from arch/x86/realmode/rm/../../boot/regs.c:19, from arch/x86/realmode/rm/regs.c:1: /usr/src/kernels/linux-next/arch/x86/include/asm/page_64_types.h: In function '__phys_addr_nodebug': /usr/src/kernels/linux-next/arch/x86/include/asm/page_64_types.h:63: warning: integer constant is too large for 'unsigned long' type /usr/src/kernels/linux-next/arch/x86/include/asm/page_64_types.h:66: warning: integer constant is too large for 'unsigned long' type /usr/src/kernels/linux-next/arch/x86/include/asm/page_64_types.h:66: warning: integer constant is too large for 'unsigned long' type The warnings all seemed to originate from several different spots throughout the x86 tree. All of the warning messages include arch/x86/boot/boot.h:26 and then from there up the included from list is always the same. Thanks, Alex -- 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/