local_irq_save not masking interrupts

Scott Wood scottwood at freescale.com
Wed Sep 27 02:52:53 EST 2006


Alex Zeffertt wrote:
> It follows from what you are saying that kmalloc(,GFP_KERNEL)
> MUST NOT occur anywhere in the call chain during a critical section.
> 
> This must catch others out too.  Surely kmalloc/cache_grow should
> return NULL rather than enable interrupts.

The local_irq_enable() is intended to reverse a previous 
local_irq_save() done in the allocator (with the assumption that if 
GFP_WAIT is specified, the flags saved had IRQs enabled), not to handle 
the case where IRQs were disabled by kmalloc's caller.  Returning NULL 
would mean that slabs can never grow with GFP_KERNEL.

 > In fact, shouldn't it be
> a BUG() if kmalloc(,GFP_KERNEL) is called with IRQs disabled?

Yes.

-Scott



More information about the Linuxppc-embedded mailing list