From: scameron@beardog.cce.hp.com
To: Tomas Henzl <thenzl@redhat.com>
Cc: "'linux-scsi@vger.kernel.org'" <linux-scsi@vger.kernel.org>,
scameron@beardog.cce.hp.com
Subject: Re: [PATCH v2, repost] hpsa: remove unneeded loop
Date: Thu, 29 May 2014 09:51:28 -0500 [thread overview]
Message-ID: <20140529145128.GO6970@beardog.cce.hp.com> (raw)
In-Reply-To: <53873DEB.1080504@redhat.com>
On Thu, May 29, 2014 at 04:02:19PM +0200, Tomas Henzl wrote:
> Originally this was first patch in a series, but while the other patches
> were accepted, this one was forgotten.
> The code below is adapted for the latest sources.
>
> The cmd_pool_bits is protected everywhere with a spinlock,
> we don't need the test_and_set_bit, set_bit is enough and the loop
> can be removed too.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
> drivers/scsi/hpsa.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 9a6e4a2..c8267f3 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -4680,15 +4680,12 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h)
> unsigned long flags;
>
> spin_lock_irqsave(&h->lock, flags);
> - do {
> - i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> - if (i == h->nr_cmds) {
> - spin_unlock_irqrestore(&h->lock, flags);
> - return NULL;
> - }
> - } while (test_and_set_bit
> - (i & (BITS_PER_LONG - 1),
> - h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0);
> + i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> + if (i == h->nr_cmds) {
> + spin_unlock_irqrestore(&h->lock, flags);
> + return NULL;
> + }
> + set_bit(i & (BITS_PER_LONG - 1), h->cmd_pool_bits + (i / BITS_PER_LONG));
> spin_unlock_irqrestore(&h->lock, flags);
>
> c = h->cmd_pool + i;
> --
> 1.8.3.1
>
I don't quite remember, but I think it was forgotten because I became
more interested in removing all the locks from the main i/o path of hpsa
for performance reasons (I have had a rather large patch series in the
works for quite a while now to do that, maybe it will be ready for 3.17,
we'll see.) So this looks ok, but if things go according to plan it won't
be relevant for very long.
-- steve
next prev parent reply other threads:[~2014-05-29 14:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-29 14:02 [PATCH v2, repost] hpsa: remove unneeded loop Tomas Henzl
2014-05-29 14:51 ` scameron [this message]
2014-05-29 15:21 ` Tomas Henzl
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=20140529145128.GO6970@beardog.cce.hp.com \
--to=scameron@beardog.cce.hp.com \
--cc=linux-scsi@vger.kernel.org \
--cc=thenzl@redhat.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).