From: "Jan Beulich" <JBeulich@suse.com>
To: "Andrew Morton" <akpm@linux-foundation.org>
Cc: "Michal Marek" <mmarek@suse.cz>, <linux-kbuild@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] consolidate WARN_...ONCE() static variables
Date: Fri, 06 Jan 2012 12:38:44 +0000 [thread overview]
Message-ID: <4F06F964020000780006ACFA@nat28.tlf.novell.com> (raw)
In-Reply-To: <20120106030329.d934f5bc.akpm@linux-foundation.org>
>>> On 06.01.12 at 12:03, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 06 Jan 2012 07:40:29 +0000 "Jan Beulich" <JBeulich@suse.com> wrote:
>
>> >>> On 05.01.12 at 22:03, Andrew Morton <akpm@linux-foundation.org> wrote:
>> > On Thu, 05 Jan 2012 11:09:40 +0000
>> > "Jan Beulich" <JBeulich@suse.com> wrote:
>> >
>> >> >>> On 05.01.12 at 00:03, Andrew Morton <akpm@linux-foundation.org> wrote:
>> >> > On Thu, 22 Dec 2011 15:53:49 +0000
>> >> > "Jan Beulich" <JBeulich@suse.com> wrote:
>> >> >
>> >> >> Due to the alignment of following variables, these typically consume
>> >> >> more than just the single byte that 'bool' requires, and as there are
>> >> >> a few hundred instances, the cache pollution (not so much the waste of
>> >> >> memory) sums op. Put these variables into their own section, outside
>> >> >> of half way frequently used memory range.
>> >> >>
>> >>
>> >> ...
>> >>
>> >> > printk_once() should also be converted. And ata_print_version_once(),
>> >> > if it insists on continuing to exist.
>> >>
>> >> I disagree for those (and intentionally didn't touch printk_once();
>> >> wasn't aware of the other) - at best this could get marked
>> >> __read_mostly, but that's not the subject of this patch.
>> >
>> > Confused. It is exactly the subject of the patch?
>>
>> No - the goal here is to eliminate the wasteful alignment holes
>> created by the __warned variables in the WARN_...ONCE()
>> instances.
>
> What are these alignment holes? I'd assumed (without thinking a lot)
> that they were little three or two byte gaps because sizeof(bool)=1 or
> 2.
The holes are typically sizeof(long) - 1 bytes (i.e. 7 on 64-bit), with
some cases of smaller/larger ones.
> But I see that sizeof(bool) is actually 4, so I don't know what
> you're talking about.
They're 1-byte variables, and System.map confirms this (with the
patch in place):
ffffffff81638808 d __warned.24033
ffffffff81638809 d __warned.25205
ffffffff8163880a d __warned.30138
ffffffff8163880b d __warned.27363
...
> Apparently there is some gcc behaviour which you know about and I
> don't.
No magic gcc behavior is involved here afaict - this example
typedef _Bool bool;
bool b;
bool test(void) {
return b;
}
unsigned size(void) {
return sizeof(bool);
}
unsigned align(void) {
return __alignof__(bool);
}
confirms that with whatever gcc I try, sizeof and __alignof__
produce 1 on x86.
Jan
prev parent reply other threads:[~2012-01-06 12:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4EF3609D0200007800069A30@nat28.tlf.novell.com>
[not found] ` <CACqU3MWahjXy3q6AqDARCfPx5r3WF+uoHXZA6mkkpNKDjWcSMA@mail.gmail.com>
2011-12-23 7:52 ` Jan Beulich
[not found] ` <20120104150305.8b2ab00c.akpm@linux-foundation.org>
[not found] ` <4F059304020000780006A906@nat28.tlf.novell.com>
[not found] ` <20120105130324.44949af9.akpm@linux-foundation.org>
2012-01-06 7:40 ` Jan Beulich
2012-01-06 11:03 ` Andrew Morton
2012-01-06 12:38 ` Jan Beulich [this message]
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=4F06F964020000780006ACFA@nat28.tlf.novell.com \
--to=jbeulich@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
/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
all inboxes | Powered by JetHome®