lkml.org 
[lkml]   [2018]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ext4: use swap macro in mext_page_double_lock
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

\
 
 \ /
  Last update: 2018-07-23 00:20    [W:0.049 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site