[openib-general] Re: Re: [Andrew Morton] inappropriate use of in_atomic()

Grant Grundler iod00d at hp.com
Mon Mar 28 20:05:10 PST 2005


On Mon, Mar 28, 2005 at 05:55:23PM -0800, Libor Michalek wrote:
> On Sun, Mar 27, 2005 at 05:58:47PM +0200, Michael S. Tsirkin wrote:
> > 
> > My understanding is you must give kmap_atomic the proper parameter:
> > KM_IRQ0/KM_SOFTIRQ0/KM_USR0, to avoid conflicts with other callers of
> > kmap on the same CPU.
> > 
> > Something like this then?
> 
>   If you're going to check for in_irq() why not just use kmap() when
> you are not in an interrupt? I think the benefit of using kmap_atomic
> all the time is that you don't need to check if you are in an
> interrupt, you just need to make sure the local interrupts are
> disabled in case you are not in an interrupt.

Sorry - parsing that last sentence kept me busy for a bit. :^)

I just wanted to point out that checking if the CPU is in an interrupt
context can be more expensive than blindly turning interrupts off.
If the branch is mispredicted, one looses on most architectures.
Typically, masking *all* interrupts for the "current" cpu is a very
efficient operation and has a smaller i-cache footprint.

grant



More information about the general mailing list