From: Coly Li <colyli@suse.de>
To: Muhammad Usama Anjum <musamaanjum@gmail.com>,
Zheng Yongjun <zhengyongjun3@huawei.com>,
Kent Overstreet <kent.overstreet@gmail.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Cc: 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: Thu, 29 Apr 2021 18:05:56 +0800 [thread overview]
Message-ID: <dab84e1a-ccc5-354e-9ef4-caf738da2faa@suse.de> (raw)
In-Reply-To: <0b4b7c5cc2f19d2d77a66c0d2ce42f63692174d9.camel@gmail.com>
On 4/29/21 12:19 AM, Muhammad Usama Anjum wrote:
> 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?
>
>
I am waiting for Yongjun's v4 patch to update the commit log, which was
suggested by Pavel Goran.
Coly Li
prev parent reply other threads:[~2021-04-29 10:06 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
2021-04-29 5:56 ` Dan Carpenter
2021-04-29 10:05 ` Coly Li [this message]
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=dab84e1a-ccc5-354e-9ef4-caf738da2faa@suse.de \
--to=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=musamaanjum@gmail.com \
--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 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).