All of lore.kernel.org
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <musamaanjum@gmail.com>
To: Coly Li <colyli@suse.de>,
	Zheng Yongjun <zhengyongjun3@huawei.com>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: musamaanjum@gmail.com, linux-bcache@vger.kernel.org,
	kernel-janitors@vger.kernel.org, Hulk Robot <hulkci@huawei.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] bcache: use DEFINE_MUTEX() for mutex lock
Date: Wed, 28 Apr 2021 21:19:26 +0500	[thread overview]
Message-ID: <0b4b7c5cc2f19d2d77a66c0d2ce42f63692174d9.camel@gmail.com> (raw)
In-Reply-To: <d7f70ce31f6f61a50c05a5d5ba03582054f144fe.camel@gmail.com>

On Tue, 2021-04-06 at 02:17 +0500, Muhammad Usama Anjum wrote:
> On Mon, 2021-04-05 at 22:02 +0800, Coly Li wrote:
> > On 4/5/21 6:14 PM, Zheng Yongjun wrote:
> > > mutex lock can be initialized automatically with DEFINE_MUTEX()
> > > rather than explicitly calling mutex_init().
> > > 
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> > 
> > NACK. This is not the first time people try to "fix" this location...
> > 
> > Using DEFINE_MUTEX() does not gain anything for us, it will generate
> > unnecessary extra size for the bcache.ko.
> > ines.
> 
> How can the final binary have larger size by just static declaration?
> By using DEFINE_MUTEX, the mutex is initialized at compile time. It'll
> save initialization at run time and one line of code will be less also
> from text section. 
> 
> #### with no change (dynamic initialization)
> size drivers/md/bcache/bcache.ko
>    text	   data	    bss	    dec	    hex	filename
>  187792	  25310	    152	 213254	  34106	drivers/md/bcache/bcache.ko
> 
> #### with patch applied (static initialization)
>    text	   data	    bss	    dec	    hex	filename
>  187751	  25342	    120	 213213	  340dd	drivers/md/bcache/bcache.ko
> 
> Module's binary size has decreased by 41 bytes with the path applied
> (x86_64 arch).
> 
Anybody has any thoughts on it?



  reply	other threads:[~2021-04-28 16:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 10:14 [PATCH -next] bcache: use DEFINE_MUTEX() for mutex lock Zheng Yongjun
2021-04-05 14:02 ` Coly Li
2021-04-05 21:17   ` Muhammad Usama Anjum
2021-04-28 16:19     ` Muhammad Usama Anjum [this message]
2021-04-29  5:56       ` Dan Carpenter
2021-04-29 10:05       ` Coly Li

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=0b4b7c5cc2f19d2d77a66c0d2ce42f63692174d9.camel@gmail.com \
    --to=musamaanjum@gmail.com \
    --cc=colyli@suse.de \
    --cc=dan.carpenter@oracle.com \
    --cc=hulkci@huawei.com \
    --cc=kent.overstreet@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhengyongjun3@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.