[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2c1a3a10bf643d693afed6d23b3baf9@AcuMS.aculab.com>
Date: Thu, 20 Jan 2022 13:02:27 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Arnd Bergmann' <arnd@...db.de>, Guo Ren <guoren@...nel.org>
CC: linux-s390 <linux-s390@...r.kernel.org>,
Guo Ren <guoren@...ux.alibaba.com>,
gregkh <gregkh@...uxfoundation.org>,
Drew Fustini <drew@...gleboard.org>,
Anup Patel <anup@...infault.org>,
Wang Junqiang <wangjunqiang@...as.ac.cn>,
the arch/x86 maintainers <x86@...nel.org>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
"linux-csky@...r.kernel.org" <linux-csky@...r.kernel.org>,
"inux-parisc@...r.kernel.org" <inux-parisc@...r.kernel.org>,
"Christoph Hellwig" <hch@...radead.org>,
Palmer Dabbelt <palmer@...belt.com>,
liush <liush@...winnertech.com>,
sparclinux <sparclinux@...r.kernel.org>,
linux-riscv <linux-riscv@...ts.infradead.org>,
"open list:BROADCOM NVRAM DRIVER" <linux-mips@...r.kernel.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Christoph Hellwig <hch@....de>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Wei Fu <wefu@...hat.com>
Subject: RE: [PATCH V3 03/17] asm-generic: compat: Cleanup duplicate
definitions
From: Arnd Bergmann
> Sent: 20 January 2022 11:52
..
> As with compat_flock, the packed attribute has no impact on the layout
> here, but please drop it anyway for consistency.
Never mind the structure layout, because 'packed' allows the
structure to be aligned on any boundary it forces the compiler
to use byte memory accesses and shifts on some architectures.
This is a horrid performance penalty.
'packed' should only be specified for structures that can
occur on any address boundary.
ie basically never.
If you need to remove the implicit pad before a field (eg 64bit
fields on x64-32) then you can mark the field itself as 'packed'.
Although, in that case, putting the attribute on the type (compat_s64)
is generally cleaner.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists