From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4: use swap macro in mext_page_double_lock
Date: Sun, 22 Jul 2018 18:19:11 -0400 [thread overview]
Message-ID: <20180722221911.GC3358@thunk.org> (raw)
In-Reply-To: <20180709131600.GA9138@embeddedor.com>
On Mon, Jul 09, 2018 at 08:16:00AM -0500, Gustavo A. R. Silva wrote:
> Make use of the swap macro and remove unnecessary variable *tmp*.
> This makes the code easier to read and maintain. Also, reduces the
> stack usage.
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
It doesn't actually reduce stack usage. Look at the definition of
swap() in include/linux/kernel.h:
#define swap(a, b) \
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
It removes the variable "tmp", and replace it with "__tmp".
It slightly reduces the number of lines of code, so it slightly makes
the code easier to maintainer. But I think you are really
over-promising how much this commit helps.
Regards,
- Ted
next prev parent reply other threads:[~2018-07-22 22:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 13:16 [PATCH] ext4: use swap macro in mext_page_double_lock Gustavo A. R. Silva
2018-07-22 22:19 ` Theodore Y. Ts'o [this message]
2018-07-22 23:30 ` Gustavo A. R. Silva
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=20180722221911.GC3358@thunk.org \
--to=tytso@mit.edu \
--cc=adilger.kernel@dilger.ca \
--cc=gustavo@embeddedor.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).