Re: [PATCH] mm: change "char *bdi_unknown_name" to "char bdi_unknown_name[]"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 12 May 2022 16:26:37 +0800 liqiong <liqiong@xxxxxxxxxxxx> wrote:

> "char bdi_unknown_nam[]" string form declares a single variable.
> It is better then "char *bdi_unknown_name" which creates two
> variables.
> 
> ...
>
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -20,7 +20,7 @@ struct backing_dev_info noop_backing_dev_info;
>  EXPORT_SYMBOL_GPL(noop_backing_dev_info);
>  
>  static struct class *bdi_class;
> -static const char *bdi_unknown_name = "(unknown)";
> +static const char bdi_unknown_name[] = "(unknown)";
>  

heh, fun patch.  We actually do this quite a lot.  

	grep -r "^[a-z].*char \*[a-z].*= \"" .

is a pathetic pattern which catches a lot of them.


However.  I expected your patch to shrink the kernel a bit, but it has
the opposite effect:

hp2:/usr/src/25> size mm/backing-dev.o
   text	   data	    bss	    dec	    hex	filename
  21288	   9396	   3808	  34492	   86bc	mm/backing-dev.o-before
  21300	   9428	   3808	  34536	   86e8	mm/backing-dev.o-after

Even .data became larger.  I didn't investigate why.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux