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

Michael S. Tsirkin mst at mellanox.co.il
Mon Mar 28 22:07:09 PST 2005


Quoting r. Libor Michalek <libor at topspin.com>:
> Subject: Re: Re: [Andrew Morton] inappropriate use of in_atomic()
> 
> 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 main benefit is that kmap is per-CPU, so we avoid flushing
TLBs globally across all CPUs.

> 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.
> Once they are disabled
> I think you can use KM_IRQ0 for all cases. With interrupts disabled
> you should never get a collision on the KM_IRQ0 page as long as the
> map/unmap occur before the interrupt is enabled, which it would in
> the SDP case.
> 
> -Libor

You are saying its cheaper to disable local interrupts than check whether
you are in interrupt? Makes sence.

-- 
MST - Michael S. Tsirkin



More information about the general mailing list