From: mrybczyn@kalray.eu (Marta Rybczynska)
Subject: [PATCH v4, under testing] nvme-rdma: support devices with queue size < 32
Date: Thu, 4 May 2017 14:50:00 +0200 (CEST) [thread overview]
Message-ID: <310709514.10440651.1493902200194.JavaMail.zimbra@kalray.eu> (raw)
In-Reply-To: <1493829456.3901.13.camel@sandisk.com>
> On Wed, 2017-05-03@19:27 +0300, Leon Romanovsky wrote:
>> On Wed, May 03, 2017@07:01:14PM +0300, Sagi Grimberg wrote:
>> > > As far as I know the compiler only does that for compile-time constants. In
>> > > this case the divisor (max(queue_size / 2, 1)) is not a compile-time constant.
>> >
>> > We could theoretically do a (sig_count & max(queue_size / 2, 1)) but
>> > that would only do well with power of 2 sized queues...
>>
>> IMHO, It is not-so-big-deal limitation.
>
> Hello Marta, Sagi and Leon,
>
> How about changing nvme_rdma_init_sig_count() such that it always returns
> a power of two? The "+ 1" in the code below makes sure that the argument of
> ilog2() is larger than zero even if queue_size == 1. I'm not sure whether
> the time needed to compute ilog2() would make it necessary to cache the
> nvme_rdma_init_sig_count() return value.
>
> static inline int nvme_rdma_init_sig_count(int queue_size)
> {
> /* Return the largest power of two that is not above half of (queue size + 1) */
> ???????return 1 << ilog2((queue_size + 1) / 2);
> }
>
> Bart.
This looks like a good idea to me. Then the division can change into
an AND. I'll come back with another version soon.
Marta
next prev parent reply other threads:[~2017-05-04 12:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 10:05 [PATCH v4, under testing] nvme-rdma: support devices with queue size < 32 Marta Rybczynska
2017-05-03 11:17 ` Leon Romanovsky
2017-05-03 15:08 ` Sagi Grimberg
2017-05-03 15:19 ` Marta Rybczynska
2017-05-03 15:45 ` Bart Van Assche
2017-05-03 15:53 ` Jason Gunthorpe
2017-05-03 15:58 ` Bart Van Assche
2017-05-03 16:01 ` Sagi Grimberg
2017-05-03 16:27 ` Leon Romanovsky
2017-05-03 16:37 ` Bart Van Assche
2017-05-03 16:49 ` Sagi Grimberg
2017-05-04 12:50 ` Marta Rybczynska [this message]
2017-05-17 9:02 ` Christoph Hellwig
2017-05-17 12:50 ` Marta Rybczynska
2017-05-03 16:17 ` Doug Ledford
2017-05-03 16:24 ` Bart Van Assche
2017-05-03 19:07 ` Doug Ledford
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=310709514.10440651.1493902200194.JavaMail.zimbra@kalray.eu \
--to=mrybczyn@kalray.eu \
/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