Re: Need to allocate memory always in interrupt handler which MUST succeed.

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

 



On Thu, 2006-10-12 at 01:40 -0700, Parav Pandit wrote:
> Hi,
>  
> I need to allocate some 256 bytes of memory in the interrupt handler
> each time when I get the interrupt. Size varies from 8 bytes to 256
> bytes.
> There are various options such as 
> (a)    kmalloc(GFP_ATOMIC), 
> (b)   kmem_cache_alloc
> (c)    mempool_alloc
> My driver need to support, at max 4096 * 256 = 1MByte buffer. I don’t
> need DMA support.
>  
> How can I use above APIs so that I always get the memory in the
> interrupt handler?
> I don’t want to implement my own memory manager where I pre-allocate
> 1Mbytes + few pointers to always avail memory in the interrupt
> handler.

you should use a mempool then; mempools can preallocate the memory for
you as long as the amount you need is bounded (like in your case)
>  
> What mechanism is used in the sk_buff allocation from the interrupt
> handler?

sk_buffs are different; if there's no memory the packet is just dropped;
that's "normal" since in networking packets can be dropped anywhere on
the network..





--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux