lkml.org 
[lkml]   [2021]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/platform/uv: make const pointer dots a static const array
On Tue, Nov 30, 2021 at 04:26:39PM -0800, Joe Perches wrote:
> On Tue, 2021-11-30 at 13:34 -0600, Steve Wahl wrote:
> > On Sat, Nov 27, 2021 at 05:03:20PM +0000, Colin Ian King wrote:
> > > Don't populate the const array dots on the stack
> []
> > Examination of the disassembly shows that the compiler actually
> > eliminates the creation of the pointer "dots" on the stack and just
> > passes the address of the string constant to the printk function.
> >
> > So this change should not have any actual effect (I don't know where
> > you got the "shrinks object code" from), and in my humble opinion
> > makes the code less clear.
>
> Probably shrinks an allmodconfig where the symbols are referenced.
> It probably doesn't do anything to a defconfig.

OK, I looked. Under allmodconfig, the new code is one byte smaller.

Defconfig doesn't include CONFIG_X86_UV and this file doesn't get
compiled.

Using defconfig plus CONFIG_X86_UV and prerequisites, the new code is
24 bytes larger, probably because of alignment added.

allmodconfig:

text data bss dec hex filename
30827 18358 1472 50657 c5e1 uv_nmi.o
30828 18358 1472 50658 c5e2 uv_nmi.orig.o

default config + CONFIG_X86_UV:

text data bss dec hex filename
9918 216 160 10294 2836 uv_nmi.o
9894 216 160 10270 281e uv_nmi.orig.o

So I still don't think this patch makes sense.

--> Steve Wahl

> > As such, unless there's something here I don't understand, I vote to
> > reject this patch.
> []
> > > but make it static
> > > const and make the pointer an array to remove a dereference. Shrinks
> > > object code a few bytes too.
> []
> > > diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
> []
> > > @@ -725,7 +725,7 @@ static void uv_nmi_dump_cpu_ip(int cpu, struct pt_regs *regs)
> > > */
> > > static void uv_nmi_dump_state_cpu(int cpu, struct pt_regs *regs)
> > > {
> > > - const char *dots = " ................................. ";
> > > + static const char dots[] = " ................................. ";
>
>

--
Steve Wahl, Hewlett Packard Enterprise

\
 
 \ /
  Last update: 2021-12-01 22:41    [W:0.077 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site