All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hirofumi Nakagawa <hnakagawa@miraclelinux.com>
To: megaraidlinux@lsi.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] megaraid_mm: moved pci_pool_alloc() from critical section to outward
Date: Fri, 15 Aug 2008 15:51:08 +0900	[thread overview]
Message-ID: <48A5275C.6050303@miraclelinux.com> (raw)

Hi
This patch moved call of pci_pool_alloc from critical section to outward.
It seems like that original code behavior schedule-in without unlock.

Note
This patch is not tested because I don't have this device.

Thanks.
Hirofumi Nakagawa

Signed-off-by: Hirofumi Nakagawa <hnakagawa@miraclelinux.com>
---
 drivers/scsi/megaraid/megaraid_mm.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index f680561..4d70906 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -499,6 +499,7 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
 	int		right_pool = -1;
 	unsigned long	flags;
 	int		i;
+	void *t;

 	kioc->pool_index	= -1;
 	kioc->buf_vaddr		= NULL;
@@ -549,17 +550,19 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
 	 * to allocate one new buffer. NOTE: This is a blocking call.
 	 */
 	pool = &adp->dma_pool_list[right_pool];
+	t = pci_pool_alloc(pool->handle, GFP_KERNEL,
+							&kioc->buf_paddr);
+
+	if (!t)
+		return -ENOMEM;

 	spin_lock_irqsave(&pool->lock, flags);

 	kioc->pool_index	= right_pool;
 	kioc->free_buf		= 1;
-	kioc->buf_vaddr 	= pci_pool_alloc(pool->handle, GFP_KERNEL,
-							&kioc->buf_paddr);
-	spin_unlock_irqrestore(&pool->lock, flags);
+	kioc->buf_vaddr 	= t;

-	if (!kioc->buf_vaddr)
-		return -ENOMEM;
+	spin_unlock_irqrestore(&pool->lock, flags);

 	return 0;
 }
-- 


                 reply	other threads:[~2008-08-15  7:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=48A5275C.6050303@miraclelinux.com \
    --to=hnakagawa@miraclelinux.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=megaraidlinux@lsi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.