From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Neil Horman <nhorman@tuxdriver.com>, Vasu Dev <vasu.dev@intel.com>
Subject: [PATCH 1/6] fcoe: Cleanup locking on fcoe_percpu_receive_thread
Date: Fri, 06 Jul 2012 10:40:05 -0700 [thread overview]
Message-ID: <20120706174005.4102.2475.stgit@fritz> (raw)
In-Reply-To: <20120706173959.4102.12091.stgit@fritz>
From: Neil Horman <nhorman@tuxdriver.com>
Noticed that we can shuffle the code around in fcoe_percpu_receive_thread a bit
and avoid taking the fcoe_rx_list lock twice per iteration. This should improve
throughput somewhat. With this change we take the lock, and check for new
frames in a single critical section. Only if the list is empty do we drop the
lock and re-acquire it after being signaled to wake up.
Change Notes:
v2) did some further cleanup on the patch by replacing the 2nd call of
spin_lock/splice_init with a goto to the top of the outer loop. This allows me
to change the inner while loop to an if conditional and remove the sencond check
of kthread_should_stop. Based on suggestion from Vasu Dev.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index fe30b1b..656ff65 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1851,23 +1851,25 @@ static int fcoe_percpu_receive_thread(void *arg)
set_user_nice(current, -20);
+retry:
while (!kthread_should_stop()) {
spin_lock_bh(&p->fcoe_rx_list.lock);
skb_queue_splice_init(&p->fcoe_rx_list, &tmp);
- spin_unlock_bh(&p->fcoe_rx_list.lock);
-
- while ((skb = __skb_dequeue(&tmp)) != NULL)
- fcoe_recv_frame(skb);
- spin_lock_bh(&p->fcoe_rx_list.lock);
- if (!skb_queue_len(&p->fcoe_rx_list)) {
+ if (!skb_queue_len(&tmp)) {
set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_bh(&p->fcoe_rx_list.lock);
schedule();
set_current_state(TASK_RUNNING);
- } else
- spin_unlock_bh(&p->fcoe_rx_list.lock);
+ goto retry;
+ }
+
+ spin_unlock_bh(&p->fcoe_rx_list.lock);
+
+ while ((skb = __skb_dequeue(&tmp)) != NULL)
+ fcoe_recv_frame(skb);
+
}
return 0;
}
next prev parent reply other threads:[~2012-07-06 17:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 17:39 [PATCH 0/6] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2012-07-06 17:40 ` Robert Love [this message]
2012-07-06 17:40 ` [PATCH 2/6] libfc: add exch timer debug info Robert Love
2012-07-06 17:40 ` [PATCH 3/6] libfc: fix retries with FDMI lport states Robert Love
2012-07-06 17:40 ` [PATCH 4/6] fcoe: Remove redundant 'less than zero' check Robert Love
2012-07-06 17:40 ` [PATCH 5/6] libfc: don't exch_done() on invalid sequence ptr Robert Love
2012-07-06 17:40 ` [PATCH 6/6] libfc: fix sending REC after FCP_RESP is received Robert Love
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=20120706174005.4102.2475.stgit@fritz \
--to=robert.w.love@intel.com \
--cc=linux-scsi@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vasu.dev@intel.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