[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180709152958.565weccfaktqauef@lakrids.cambridge.arm.com>
Date: Mon, 9 Jul 2018 16:29:58 +0100
From: Mark Rutland <mark.rutland@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Alexey Brodkin <Alexey.Brodkin@...opsys.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"linux-snps-arc@...ts.infradead.org"
<linux-snps-arc@...ts.infradead.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"greg@...ah.com" <greg@...ah.com>,
"will.deacon@....com" <will.deacon@....com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"David.Laight@...LAB.COM" <David.Laight@...LAB.COM>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"geert@...ux-m68k.org" <geert@...ux-m68k.org>
Subject: Re: [PATCH v3] devres: Explicitly align datai[] to 64-bit
On Mon, Jul 09, 2018 at 04:49:25PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 09, 2018 at 02:33:26PM +0000, Alexey Brodkin wrote:
> > > In fact, since alloc_dr() uses kmalloc() to allocate the entire thing,
> > > it is impossible to guarantee a larger alignment than kmalloc does.
> >
> > Well but 4-bytes [which is critical for atomic64_t] should be much less
> > than a sane cache line length so above should work.
>
> AFAICT ARCH_KMALLOC_MINALIGN ends up being 4 on x86_32 (it doesn't
> define ARCH_DMA_MINALIGN and doesn't seem to otherwise override the
> thing).
Shouldn't that be 8? AFAICT, __alignof__(unsigned long long) is 8 on
x86_32:
----
[mark@...rids:~]% cat test.c
#include <stdio.h>
#define PRINT_TYPE_INFO(t) \
printf("%10s %5d %5d\n", #t, sizeof(t), __alignof__(t))
int main(int argc, char *argv[])
{
printf("%10s %5s %5s\n", "TYPE", "SIZE", "ALIGN");
PRINT_TYPE_INFO(int);
PRINT_TYPE_INFO(long);
PRINT_TYPE_INFO(long long);
return 0;
}
[mark@...rids:~]% gcc -m32 test.c -o test
[mark@...rids:~]% ./test
TYPE SIZE ALIGN
int 4 4
long 4 4
long long 8 8
----
Mark.
Powered by blists - more mailing lists