mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Justin TerAvest <teravest@google.com>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/4] cfq-iosched: reduce bit operations in cfq_choose_req()
Date: Tue, 24 May 2011 10:34:16 -0700	[thread overview]
Message-ID: <BANLkTi=kur2RMzUNC4V1R-R86qJZrk1n6Q@mail.gmail.com> (raw)
In-Reply-To: <1306207131-2296-2-git-send-email-namhyung@gmail.com>

Why make this change? Are we that sensitive to the number of operations?

It makes the code a bit harder to read, I think.

On Mon, May 23, 2011 at 8:18 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> Reduce the number of bit operations in cfq_choose_req() on average
> (and worst) cases.
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  block/cfq-iosched.c |   14 +++++---------
>  1 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index 151a050e692c..a79e62063144 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -665,15 +665,11 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2,
>        if (rq2 == NULL)
>                return rq1;
>
> -       if (rq_is_sync(rq1) && !rq_is_sync(rq2))
> -               return rq1;
> -       else if (rq_is_sync(rq2) && !rq_is_sync(rq1))
> -               return rq2;
> -       if ((rq1->cmd_flags & REQ_META) && !(rq2->cmd_flags & REQ_META))
> -               return rq1;
> -       else if ((rq2->cmd_flags & REQ_META) &&
> -                !(rq1->cmd_flags & REQ_META))
> -               return rq2;
> +       if (rq_is_sync(rq1) != rq_is_sync(rq2))
> +               return rq_is_sync(rq1) ? rq1 : rq2;
> +
> +       if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_META)
> +               return rq1->cmd_flags & REQ_META ? rq1 : rq2;
>
>        s1 = blk_rq_pos(rq1);
>        s2 = blk_rq_pos(rq2);
> --
> 1.7.5.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

  reply	other threads:[~2011-05-24 17:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24  3:18 [PATCH 1/4] cfq-iosched: algebraic simplification in cfq_prio_to_maxrq() Namhyung Kim
2011-05-24  3:18 ` [PATCH 2/4] cfq-iosched: reduce bit operations in cfq_choose_req() Namhyung Kim
2011-05-24 17:34   ` Justin TerAvest [this message]
2011-05-25  2:34     ` Namhyung Kim
2011-05-24  3:18 ` [PATCH 3/4] cfq-iosched: remove unused 'group_changed' in cfq_service_tree_add() Namhyung Kim
2011-05-24 17:32   ` Justin TerAvest
2011-05-24  3:18 ` [PATCH 4/4] cfq-iosched: free cic_index if cfqd allocation fails Namhyung Kim
2011-05-24  8:13 ` [PATCH 1/4] cfq-iosched: algebraic simplification in cfq_prio_to_maxrq() Jens Axboe

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='BANLkTi=kur2RMzUNC4V1R-R86qJZrk1n6Q@mail.gmail.com' \
    --to=teravest@google.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@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

all inboxes | Powered by JetHome®