linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: linux-scsi@vger.kernel.org
Subject: Re: Setting queue depths in the scsi mid layer, an intro
Date: Mon, 14 Oct 2002 21:28:09 -0400	[thread overview]
Message-ID: <20021015012809.GG1274@redhat.com> (raw)
In-Reply-To: <20021014181512.A7237@eng2.beaverton.ibm.com>

On Mon, Oct 14, 2002 at 06:15:12PM -0700, Patrick Mansfield wrote:
> Doug -
> 
> Finally looking at and using the new queue depth code in 2.5.42.
> 
> Why are there two kmalloc()'s in scsi.c scsi_build_commandblocks()? 
> 
> They both use the same flags, including GFP_ATOMIC:
> 
> void scsi_build_commandblocks(Scsi_Device * SDpnt)
> {
> 	unsigned long flags;
> 	Scsi_Cmnd *SCpnt;
> 
> 	if (SDpnt->queue_depth != 0)
> 		return;
> 		
> 	SCpnt = (Scsi_Cmnd *) kmalloc(sizeof(Scsi_Cmnd), GFP_ATOMIC |
> 			(SDpnt->host->unchecked_isa_dma ? GFP_DMA : 0));
> 	if (NULL == SCpnt) {
> 		/*
> 		 * Since we don't currently have *any* command blocks on this
> 		 * device, go ahead and try an atomic allocation...
> 		 */
> 		SCpnt = (Scsi_Cmnd *) kmalloc(sizeof(Scsi_Cmnd), GFP_ATOMIC |
> 			(SDpnt->host->unchecked_isa_dma ? GFP_DMA : 0));
> 		if (NULL == SCpnt)
> 			return;	/* Oops, we aren't going anywhere for now */
> 	}

Oops.  Oversight.  It was from the time when I had the first allocation as 
GFP_KERNEL and then an ATOMIC backup.  I changed that because this is 
called from non-sleep allowed contexts (tasklet/softirq) and therefore 
must always use ATOMIC.  So, it only needs one allocation attempt.


-- 
  Doug Ledford <dledford@redhat.com>     919-754-3700 x44233
         Red Hat, Inc. 
         1801 Varsity Dr.
         Raleigh, NC 27606
  

      reply	other threads:[~2002-10-15  1:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-11  2:46 Setting queue depths in the scsi mid layer, an intro Doug Ledford
2002-10-11 10:34 ` Alan Cox
2002-10-11 10:39   ` Doug Ledford
2002-10-11 12:47     ` Alan Cox
2002-10-11 12:49       ` Doug Ledford
2002-10-11 13:22         ` Alan Cox
2002-10-15  1:15 ` Patrick Mansfield
2002-10-15  1:28   ` Doug Ledford [this message]

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=20021015012809.GG1274@redhat.com \
    --to=dledford@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    /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).