From: Joe Perches <joe@perches.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors <kernel-janitors@vger.kernel.org>,
cocci <cocci@systeme.lip6.fr>,
kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: [Cocci] linux-kernel janitorial RFP: Mark static arrays as const
Date: Tue, 02 Mar 2021 18:47:51 -0800 [thread overview]
Message-ID: <6b8b250a06a98ce42120a14824531a8641f5e8aa.camel@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2103022241050.2906@hadrien>
On Tue, 2021-03-02 at 22:41 +0100, Julia Lawall wrote:
>
> On Tue, 2 Mar 2021, Joe Perches wrote:
>
> > Here is a possible opportunity to reduce data usage in the kernel.
>
> Does it actually reduce data usage?
Yes, at least for gcc. For instance:
$ gcc --version
gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0
And with the diff below (x86-64 defconfig with hwmon/pmbus and max20730)
$ diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
index 9dd3dd79bc18..b824eab95456 100644
--- a/drivers/hwmon/pmbus/max20730.c
+++ b/drivers/hwmon/pmbus/max20730.c
@@ -434,7 +434,7 @@ static long direct_to_val(u16 w, enum pmbus_sensor_classes >
return d;
}
-static u32 max_current[][5] = {
+static const u32 max_current[][5] = {
[max20710] = { 6200, 8000, 9700, 11600 },
[max20730] = { 13000, 16600, 20100, 23600 },
[max20734] = { 21000, 27000, 32000, 38000 },
$ size drivers/hwmon/pmbus/max20730.o*
text data bss dec hex filename
9245 256 0 9501 251d drivers/hwmon/pmbus/max20730.o.gcc.new
9149 352 0 9501 251d drivers/hwmon/pmbus/max20730.o.gcc.old
with clang-11 it doesn't seem to make a difference:
$ /usr/bin/clang --version
Ubuntu clang version 11.0.0-2
$ size drivers/hwmon/pmbus/max20730.o*
text data bss dec hex filename
9166 256 1 9423 24cf drivers/hwmon/pmbus/max20730.o.clang-11.new
9166 256 1 9423 24cf drivers/hwmon/pmbus/max20730.o.clang-11.old
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2021-03-03 15:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 17:42 [Cocci] linux-kernel janitorial RFP: Mark static arrays as const Joe Perches
2021-03-02 21:41 ` Julia Lawall
2021-03-03 2:47 ` Joe Perches [this message]
2021-03-02 22:18 ` Bernd Petrovitsch
2021-03-03 8:36 ` Julia Lawall
2021-03-04 8:34 ` Andy Shevchenko
2021-03-03 9:41 ` Rasmus Villemoes
2021-03-03 14:51 ` Joe Perches
2021-03-07 19:14 ` Julia Lawall
2021-03-08 5:38 ` Joe Perches
2021-03-08 6:54 ` Julia Lawall
2021-03-03 17:06 ` Mansour Moufid
2021-03-03 17:21 ` Julia Lawall
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=6b8b250a06a98ce42120a14824531a8641f5e8aa.camel@perches.com \
--to=joe@perches.com \
--cc=cocci@systeme.lip6.fr \
--cc=julia.lawall@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernelnewbies@kernelnewbies.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).