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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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 04E0AC433F5 for ; Thu, 12 May 2022 20:00:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86A116B0073; Thu, 12 May 2022 16:00:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 818AB6B0075; Thu, 12 May 2022 16:00:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 706706B0078; Thu, 12 May 2022 16:00:54 -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 5E8636B0073 for ; Thu, 12 May 2022 16:00:54 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 37ACE949 for ; Thu, 12 May 2022 20:00:54 +0000 (UTC) X-FDA: 79458159228.11.597E3E0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 4470C1800B6 for ; Thu, 12 May 2022 20:00:51 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88B2661D80; Thu, 12 May 2022 20:00:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D09F4C385B8; Thu, 12 May 2022 20:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652385652; bh=gj5imhNP1kGbjLtES03/wUeaRho9QAjqu8qpTgUzxvc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YKi3IOX2stMb8eNuUxfBVl80Bs/rLWGkKHxwnnm2xhETa4PR35vXp6B4jd3pFWtNT QrZYRMmndeMN7V6bkN7d0VUgVVRdDvuO+FsB621k0G5bzU0G2SIfEja6m+zE0lQTnS UkwQdGNsNYDLkKWHHvf7jgUHC/0V3RwyGSYVa+II= Date: Thu, 12 May 2022 13:00:51 -0700 From: Andrew Morton To: liqiong Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: change "char *bdi_unknown_name" to "char bdi_unknown_name[]" Message-Id: <20220512130051.94a0c53e5d1498292473975d@linux-foundation.org> In-Reply-To: <20220512082637.24649-1-liqiong@nfschina.com> References: <20220512082637.24649-1-liqiong@nfschina.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4470C1800B6 X-Stat-Signature: r9gqed454u8361k1gc74ewc7141aa4oi X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=YKi3IOX2; spf=pass (imf06.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1652385651-896962 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: On Thu, 12 May 2022 16:26:37 +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. > > ... > > --- 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.