From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BEC5C433F5 for ; Thu, 12 May 2022 20:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358240AbiELUA6 (ORCPT ); Thu, 12 May 2022 16:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbiELUA4 (ORCPT ); Thu, 12 May 2022 16:00:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 762F04704F for ; Thu, 12 May 2022 13:00:54 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 2D527B82B1B for ; Thu, 12 May 2022 20:00:53 +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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.