public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Kennedy <richard@rsk.demon.co.uk>
To: David Miller <davem@davemloft.net>
Cc: tj@kernel.org, fweisbec@gmail.com, sparclinux@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [BUG] percpu misaligned allocation
Date: Fri, 19 Mar 2010 15:48:33 +0000	[thread overview]
Message-ID: <4BA39CD1.8060900@rsk.demon.co.uk> (raw)
In-Reply-To: <20100318.200205.59696640.davem@davemloft.net>

On 19/03/10 03:02, David Miller wrote:
> From: Tejun Heo <tj@kernel.org>
> Date: Fri, 19 Mar 2010 11:18:51 +0900
> 
>> On 03/19/2010 10:57 AM, David Miller wrote:
>>> I would use u64 so something like:
>>>
>>> 	u64 [FTRACE_MAX_PROFILE_SIZE / sizeof(u64)]
>>
>> <paranoid>DIV_ROUND_UP() would be safer than division</paranoid>
> 
> There's potential real trouble if it isn't a multiple of sizeof(u64)
> so better:
> 
> 	BUILD_BUG_ON(FTRACE_MAX_PROFILE_SIZE % sizeof(u64));
> 
> :-)
> 
> What a mess, just because this thing can't be typed properly :-/
> --
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Couldn't you use a union?

For example if you have
union test {
	long t;
	char buffer[50];
};
gcc will then do the right thing.

on x86_64 sizeof(union test) = 56
but on x86_32 it's only 52.

regards
Richard


  reply	other threads:[~2010-03-19 15:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  4:49 [BUG] percpu misaligned allocation Frederic Weisbecker
2010-03-18  6:26 ` David Miller
2010-03-18  6:28   ` David Miller
2010-03-18  6:36     ` Li Zefan
2010-03-18  6:39   ` Li Zefan
2010-03-18 16:56     ` Frederic Weisbecker
2010-03-18  9:30 ` Tejun Heo
2010-03-18 19:50   ` Frederic Weisbecker
2010-03-19  0:54   ` David Miller
2010-03-19  1:31     ` Frederic Weisbecker
2010-03-19  1:51       ` Tejun Heo
2010-03-19  1:57       ` David Miller
2010-03-19  2:18         ` Tejun Heo
2010-03-19  2:30           ` Frederic Weisbecker
2010-03-19  3:02           ` David Miller
2010-03-19 15:48             ` Richard Kennedy [this message]
2010-03-24 20:54 ` Maciej Rutecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA39CD1.8060900@rsk.demon.co.uk \
    --to=richard@rsk.demon.co.uk \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox