From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0441C433F5 for ; Thu, 12 May 2022 17:10:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 432056B0074; Thu, 12 May 2022 13:10:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E1196B0075; Thu, 12 May 2022 13:10:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 281AC6B0078; Thu, 12 May 2022 13:10:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 16DD96B0074 for ; Thu, 12 May 2022 13:10:45 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id E934A8080A for ; Thu, 12 May 2022 17:10:44 +0000 (UTC) X-FDA: 79457730408.11.690FA3B Received: from mail.nfschina.com (unknown [124.16.136.209]) by imf17.hostedemail.com (Postfix) with ESMTP id 47E69400B2 for ; Thu, 12 May 2022 17:10:23 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 35B681E80D6B; Fri, 13 May 2022 01:05:03 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VMlKyIXNQHXH; Fri, 13 May 2022 01:05:00 +0800 (CST) Received: from [172.30.21.106] (unknown [180.167.10.98]) (Authenticated sender: liqiong@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id AB25F1E80D22; Fri, 13 May 2022 01:05:00 +0800 (CST) Subject: Re: [PATCH] mm: change "char *bdi_unknown_name" to "char bdi_unknown_name[]" To: Muchun Song Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220512082637.24649-1-liqiong@nfschina.com> From: liqiong Message-ID: Date: Fri, 13 May 2022 01:10:36 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=none; spf=none (imf17.hostedemail.com: domain of liqiong@nfschina.com has no SPF policy when checking 124.16.136.209) smtp.mailfrom=liqiong@nfschina.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 47E69400B2 X-Rspam-User: X-Stat-Signature: kezw5cpymmgq6uxg7i879tppmdtgmswd X-HE-Tag: 1652375423-197666 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 在 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 >> --- >> 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楼