public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Sagi Grimberg <sagi@grimberg.me>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	Jens Axboe <axboe@fb.com>
Cc: Linux Block Layer Mailinglist <linux-block@vger.kernel.org>,
	Hannes Reinecke <hare@suse.de>,
	Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>,
	Jan Kara <jack@suse.cz>
Subject: Re: [PATCH] block: respect virtual boundary mask in bvecs
Date: Wed, 07 Nov 2018 08:10:19 -0800	[thread overview]
Message-ID: <1541607019.196084.210.camel@acm.org> (raw)
In-Reply-To: <950a7996-e0f7-ff34-04da-47581a9496f0@grimberg.me>

On Tue, 2018-11-06 at 19:30 -0800, Sagi Grimberg wrote:
> > > How about changing that expression into the following to make it easier
> > > for the compiler to optimize this code?
> > > 
> > > (offset | (bprv->bv_offset + bprv->bv_len)) & queue_virt_boundary(q)
> > 
> > Uhm I have to admit I'm not really able to parse the above expression.
> > Sure GCC will do it but I think it's less readable (at least for me).
> > Let's see what other's think.
> 
> I personally not a huge fan of decoding complicated expressions. But if
> others are fine with it then I am too...

What I proposed is not a new pattern. It is a pattern that is already used
elsewhere in the Linux kernel. A few examples:

From dmabounce.c:

		/* Figure out if we need to bounce from the DMA mask. */
		if ((dma_addr | (dma_addr + size - 1)) & ~mask)
			return 1;

From dma-direct.h:

	if ((addr | (addr + size - 1)) & ~mask)
		return 0;

Bart.

  reply	other threads:[~2018-11-07 16:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 10:23 [PATCH] block: respect virtual boundary mask in bvecs Johannes Thumshirn
2018-11-05 10:55 ` Ming Lei
2018-11-05 11:50   ` Johannes Thumshirn
2018-11-05 12:01     ` Ming Lei
2018-11-06 12:34       ` Johannes Thumshirn
2018-11-06 14:56         ` Ming Lei
2018-11-06 15:14           ` Keith Busch
2018-11-07  3:14           ` Sagi Grimberg
2018-11-07  3:11         ` Sagi Grimberg
2018-11-06 14:31 ` Keith Busch
2018-11-06 14:53 ` Bart Van Assche
2018-11-06 14:56   ` Johannes Thumshirn
2018-11-07  3:30     ` Sagi Grimberg
2018-11-07 16:10       ` Bart Van Assche [this message]
2018-11-08 15:04         ` Christoph Hellwig

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=1541607019.196084.210.camel@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@fb.com \
    --cc=hare@suse.de \
    --cc=jack@suse.cz \
    --cc=jthumshirn@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sagi@grimberg.me \
    /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