lkml.org 
[lkml]   [2018]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [GIT PULL] Driver core fix for 4.20-rc5
On Fri, Nov 30, 2018 at 8:06 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> It resolves an issue with the data alignment in 'struct devres' for the
> ARC platform. The full details are in the commit changelog, but the
> short summary is the change is a single line:
>
> - unsigned long long data[]; /* guarantee ull alignment */
> + u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];

Hmm.

Are you aware that this is up to 128 bytes? Including on common
architectures like ARM64?

I've done the pull, but honestly, that seems a bit excessive, when a
fair amount of devres users seem to have fairly small data (ie looking
at "size", I see things like

p = devres_alloc(dmam_device_release, sizeof(void *), GFP_KERNEL);

or

dr = devres_alloc(devm_gpio_release, sizeof(unsigned), GFP_KERNEL);

that have allocations of a couple of bytes, and the new model means
that those allocations will be aligned to 128-byte boundaries, and
then (because ARCH_KMALLOC_MINALIGN, again) you'll end up actually
wasting 256 bytes for a tiny structure on ARM64.

Maybe it doesn't matter. But it does seem somewhat excessive to do
things like this.

Yeah, on x86, the alignment isn't even noticeable, being just 8 bytes.

Linus

\
 
 \ /
  Last update: 2018-11-30 21:42    [W:0.095 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site