Re: [PATCH/Resend] md: Push down data integrity code to personalities.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13:31, Neil Brown wrote:
> > Thanks. Sorry if this is a FAQ, but how can one tell whether a given
> > function may be called in interrupt context? Is there a better way
> > than recursively checking all its callers?
> 
> I think you just have to 'know'. :-(
> Some functions which mustn't be called from interrupts are
> 'documented' as such by calling "might_sleep()", but there is no
> similar documentation for the reverse.

There's exactly one call to might_sleep() in drivers/md/*.c ;)

> All ->bi_endio routines are called from interrupts.. or maybe
> from softirqs or something similar.  I think the important point is
> that they are called without a process context, so they cannot sleep
> (i.e. no kmalloc unless you use GFP_ATOMIC, no mutex_lock, no
> wait_event etc) and should use spin_lock_irqsave or spin_lock_bh
> rather than a bare spin_lock.

So spin_lock_irqsave() and friends are other indicators that the
function in question might be called from interrupts while kmalloc(...,
GFP_KERNEL) indicates the converse, i.e. that the function is called
with process context.

Thanks for the explanation.
Andre
-- 
The only person who always got his work done by Friday was Robinson Crusoe

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux