All of lore.kernel.org
 help / color / mirror / Atom feed
* question on scsi_alloc_sdev()
@ 2006-08-10 14:37 Martin Peschke
  2006-08-10 15:03 ` James Bottomley
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Peschke @ 2006-08-10 14:37 UTC (permalink / raw)
  To: linux-scsi

Does anybody know for sure whether scsi_alloc_sdev() is guaranteed to
be called in process context or not?

There seem to be contradictory signs in scsi_scan.c:
scsi_alloc_sdev() uses GFP_ATOMIC, as related functions do.
It might be called in a section protected by a mutex.

I conducted a little experiment using might_sleep() in scsi_alloc_sdev()
- no backtrace on the console, hence process context.

Or, is the purpose of GFP_ATOMIC just (SCSI) I/O avoidance, and sleeping
isn't an issue?

Thanks,
Martin


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question on scsi_alloc_sdev()
  2006-08-10 14:37 question on scsi_alloc_sdev() Martin Peschke
@ 2006-08-10 15:03 ` James Bottomley
  0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2006-08-10 15:03 UTC (permalink / raw)
  To: Martin Peschke; +Cc: linux-scsi

On Thu, 2006-08-10 at 16:37 +0200, Martin Peschke wrote:
> Does anybody know for sure whether scsi_alloc_sdev() is guaranteed to
> be called in process context or not?

It's always called in the scan or setup path, so yes, process context is
guaranteed.

> There seem to be contradictory signs in scsi_scan.c:
> scsi_alloc_sdev() uses GFP_ATOMIC, as related functions do.
> It might be called in a section protected by a mutex.

It is always protected by the scan mutex, but a mutex is a sleeping
lock, so it could also be GFP_KERNEL.

> I conducted a little experiment using might_sleep() in scsi_alloc_sdev()
> - no backtrace on the console, hence process context.
> 
> Or, is the purpose of GFP_ATOMIC just (SCSI) I/O avoidance, and sleeping
> isn't an issue?

I'm guessing it's just historical.

James



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-10 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-10 14:37 question on scsi_alloc_sdev() Martin Peschke
2006-08-10 15:03 ` James Bottomley

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.