[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1Fu64YhQzvSEy8j3oZ3XwUN81fY+K6Z6ksHhqDWzbxNA@mail.gmail.com>
Date: Fri, 26 Apr 2019 11:27:41 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Darren Hart (VMware)" <dvhart@...radead.org>,
Mattias Jacobsson <2pi@....nu>, Jeff Mahoney <jeffm@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mod_devicetable.h: reduce sizeof(struct of_device_id) by
80 bytes
On Thu, Apr 25, 2019 at 10:31 PM Rasmus Villemoes
<linux@...musvillemoes.dk> wrote:
>
> A typical kernel image has hundreds of static struct of_device_id
> instances (a lot of which are sentinel all-zeroes), each occupying
> ~200 bytes. Nobody initializes the .compatible member with strings
> anywhere near 128 bytes, so a lot of that memory is simply wasted.
>
> To verify, I first had the 0day bot chew on a patch adding a dummy
> extremely long .compatible string, and I did get an email saying that
> the patch resulted in lots of new
> "warning:initializer-string-for-array-of-chars-is-too-long"
> warnings. Then I had it chew on a version of this patch reducing to 46
> (because gcc unfortunately does not warn when the literal sans the
> terminating nul just fits), and got a SUCCESS mail listing 107
> config/arch combinations.
>
> For an arm imx_v6_v7_defconfig kernel, .rodata becomes 70K smaller;
> .init.data shrinks by another ~13K, making the whole kernel image
> about 83K, or 0.3%, smaller.
>
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
The space savings are nice, but I wonder if the format of these
structures is part of the ABI or not. I have some vague recollection
of that, but it's possible that it's no longer true in this century.
scripts/mod/file2alias.c processes the structures into a different
format and seems to be written specifically to avoid problems
with changes like the one you did. Can anyone confirm that
this is true before we apply the patch?
Arnd
Powered by blists - more mailing lists