linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Noll <maan@systemlinux.org>
To: Neil Brown <neilb@suse.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH/Resend] md: Push down data integrity code to personalities.
Date: Fri, 7 Aug 2009 18:46:54 +0200	[thread overview]
Message-ID: <20090807164654.GC21495@skl-net.de> (raw)
In-Reply-To: <19066.20143.666654.818111@notabene.brown>

[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2009-08-07 16:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01  8:38 [PATCH/Resend] md: Push down data integrity code to personalities Andre Noll
2009-07-07  3:42 ` Neil Brown
2009-07-07 13:44   ` Andre Noll
2009-07-07 22:10   ` Bill Davidsen
2009-07-13  8:54   ` Andre Noll
2009-07-31  5:06     ` Neil Brown
2009-08-03 16:40       ` Andre Noll
2009-08-04  5:28         ` Martin K. Petersen
2009-08-06  8:37           ` Andre Noll
2009-08-07  4:48             ` Martin K. Petersen
2009-08-06  3:31         ` Neil Brown
2009-08-07 16:46           ` Andre Noll [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=20090807164654.GC21495@skl-net.de \
    --to=maan@systemlinux.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=neilb@suse.de \
    /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).