From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752931Ab0CSBvi (ORCPT ); Thu, 18 Mar 2010 21:51:38 -0400 Received: from hera.kernel.org ([140.211.167.34]:57066 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752173Ab0CSBvh (ORCPT ); Thu, 18 Mar 2010 21:51:37 -0400 Message-ID: <4BA2D8A4.2080409@kernel.org> Date: Fri, 19 Mar 2010 10:51:32 +0900 From: Tejun Heo User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100228 SUSE/3.0.3-1.1.1 Thunderbird/3.0.3 MIME-Version: 1.0 To: Frederic Weisbecker CC: David Miller , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [BUG] percpu misaligned allocation References: <20100318044930.GC5045@nowhere> <4BA1F2BA.30604@kernel.org> <20100318.175413.183069013.davem@davemloft.net> <20100319013119.GB22095@nowhere> In-Reply-To: <20100319013119.GB22095@nowhere> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (hera.kernel.org [127.0.0.1]); Fri, 19 Mar 2010 01:51:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On 03/19/2010 10:31 AM, Frederic Weisbecker wrote: > On Thu, Mar 18, 2010 at 05:54:13PM -0700, David Miller wrote: >> From: Tejun Heo >> Date: Thu, 18 Mar 2010 18:30:34 +0900 >> >>> >>> if (!total_profile_count) { >>> - buf = (char *)alloc_percpu(perf_trace_t); >>> + buf = (char *)__alloc_percpu(sizeof(perf_trace_t), >>> + __alignof__(unsigned long)); >>> if (!buf) >>> goto fail_buf; >> >> Why not make perf_trace_t have the proper alignment? Sure, I just wanted to verify the cause of the problem. > So, making perf_trace_t as align(8) would do the trick? > I lack the knowledge about alignment layout for archs that > need aligned accesses. If you can't make it a proper type, __alignof__(unsigned long long) would be better. > Yeah but we need a generic type. This is because > our buffer can be of any random type to match all > the trace event layouts we have, all of them being > generated by macros. I hope those macros align properly according to types. Thanks. -- tejun