From: Borislav Petkov <bp@alien8.de>
To: Changli Gao <xiaosuo@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] fs: optimize mpage_bio_submit()
Date: Sat, 29 May 2010 14:47:35 +0200 [thread overview]
Message-ID: <20100529124735.GB25092@liondog.tnic> (raw)
In-Reply-To: <1275095966-18382-1-git-send-email-xiaosuo@gmail.com>
From: Changli Gao <xiaosuo@gmail.com>
Date: Sat, May 29, 2010 at 09:19:26AM +0800
> optimize mpage_bio_submit()
>
> check rw, then initialize bio->bi_end_io.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ----
> fs/mpage.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> diff --git a/fs/mpage.c b/fs/mpage.c
> index 94ff0d1..632681c 100644
> --- a/fs/mpage.c
> +++ b/fs/mpage.c
> @@ -85,9 +85,7 @@ static void mpage_end_io_write(struct bio *bio, int err)
>
> static struct bio *mpage_bio_submit(int rw, struct bio *bio)
> {
> - bio->bi_end_io = mpage_end_io_read;
> - if (rw == WRITE)
> - bio->bi_end_io = mpage_end_io_write;
> + bio->bi_end_io = rw != WRITE ? mpage_end_io_read : mpage_end_io_write;
> submit_bio(rw, bio);
> return NULL;
ok, can you sincerely tell me that your change makes the code more
readable? And have you checked to see what the compiler actually
"optimizes"?
original code:
movq $mpage_end_io_read, %rdx #, tmp65
movq $mpage_end_io_write, %rax #, tmp64
cmpl $1, %edi #, rw
cmovne %rdx, %rax # tmp65,, tmp64
movq %rax, 80(%rsi) # tmp64, <variable>.bi_end_io
.loc 1 91 0
call submit_bio #
your change:
movq $mpage_end_io_read, %rdx #, tmp63
movq $mpage_end_io_write, %rax #, iftmp.561
cmpl $1, %edi #, rw
cmovne %rdx, %rax # tmp63,, iftmp.561
movq %rax, 80(%rsi) # iftmp.561, <variable>.bi_end_io
.loc 1 90 0
call submit_bio #
so that change does nothing except obfuscating the source a bit more so
that you get more headaches whenever you look at it.
--
Regards/Gruss,
Boris.
next prev parent reply other threads:[~2010-05-29 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-29 1:19 [PATCH 2/2] fs: optimize mpage_bio_submit() Changli Gao
2010-05-29 12:47 ` Borislav Petkov [this message]
2010-05-29 13:33 ` Changli Gao
2010-05-29 13:43 ` Borislav Petkov
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=20100529124735.GB25092@liondog.tnic \
--to=bp@alien8.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=xiaosuo@gmail.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).