archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <>
To: Coly Li <>,
	Zheng Yongjun <>,
	Kent Overstreet <>
Cc:,,, Hulk Robot <>
Subject: Re: [PATCH -next] bcache: use DEFINE_MUTEX() for mutex lock
Date: Tue, 06 Apr 2021 02:17:25 +0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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 <>
> > Signed-off-by: Zheng Yongjun <>
> 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).

  reply	other threads:[~2021-04-05 21:17 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 [this message]
2021-04-28 16:19     ` Muhammad Usama Anjum
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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \

* 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).