linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: liqiong <liqiong@nfschina.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: change "char *bdi_unknown_name" to "char bdi_unknown_name[]"
Date: Fri, 13 May 2022 01:10:36 +0800	[thread overview]
Message-ID: <f4317b85-0a7b-913c-6d45-9f8b7c65e40b@nfschina.com> (raw)
In-Reply-To: <Yn0n23MRQ+wD1ZWN@FVFYT0MHHV2J.usts.net>



在 2022年05月12日 23:29, Muchun Song 写道:
> On Thu, May 12, 2022 at 04:26:37PM +0800, liqiong wrote:
>> "char bdi_unknown_nam[]" string form declares a single variable.
>> It is better then "char *bdi_unknown_name" which creates two
>> variables.
>>
> Sorry, I do not understand what you are saying here.  Creating
> two variables means what?
>
> Thanks.

Hi there,

The string form of "char *" creates two variables in the final assembly output, 
a static string, and a char pointer to the static string.

Use "objdump -S -D *.o", can find out the static string occurring at 
"Contents of section .rodata".


>  
>> Signed-off-by: liqiong <liqiong@nfschina.com>
>> ---
>>  mm/backing-dev.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
>> index 7176af65b103..4982ccc63536 100644
>> --- 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)";
>>  
>>  /*
>>   * bdi_lock protects bdi_tree and updates to bdi_list. bdi_list has RCU
>> -- 
>> 2.11.0
>>
>>

-- 
李力琼 <13524287433>
上海市浦东新区海科路99号中科院上海高等研究院3号楼3楼


  reply	other threads:[~2022-05-12 17:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12  8:26 [PATCH] mm: change "char *bdi_unknown_name" to "char bdi_unknown_name[]" liqiong
2022-05-12 14:48 ` liqiong
2022-05-12 15:29 ` Muchun Song
2022-05-12 17:10   ` liqiong [this message]
2022-05-12 20:00 ` Andrew Morton
2022-05-13  6:34   ` liqiong
2022-05-13 11:06   ` David Laight
2022-05-13 14:27     ` Muchun Song

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=f4317b85-0a7b-913c-6d45-9f8b7c65e40b@nfschina.com \
    --to=liqiong@nfschina.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=songmuchun@bytedance.com \
    /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).