* [patch 150/158] mm/shmem.c: make array 'values' static const, makes object smaller
@ 2019-12-01 1:58 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2019-12-01 1:58 UTC (permalink / raw)
To: akpm, colin.king, hughd, linux-mm, mm-commits, torvalds
From: Colin Ian King <colin.king@canonical.com>
Subject: mm/shmem.c: make array 'values' static const, makes object smaller
Don't populate the array 'values' on the stack but instead make it static
const. Makes the object code smaller by 111 bytes.
Before:
text data bss dec hex filename
108612 11169 512 120293 1d5e5 mm/shmem.o
After:
text data bss dec hex filename
108437 11233 512 120182 1d576 mm/shmem.o
(gcc version 9.2.1, amd64)
Link: http://lkml.kernel.org/r/20190906143012.28698-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/shmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/shmem.c~mm-shmemc-make-array-values-static-const-makes-object-smaller
+++ a/mm/shmem.c
@@ -3932,7 +3932,7 @@ out2:
static ssize_t shmem_enabled_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
- int values[] = {
+ static const int values[] = {
SHMEM_HUGE_ALWAYS,
SHMEM_HUGE_WITHIN_SIZE,
SHMEM_HUGE_ADVISE,
_
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-12-01 1:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01 1:58 [patch 150/158] mm/shmem.c: make array 'values' static const, makes object smaller akpm
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).