GFP_ATOMIC means roughly "make the allocation operation atomic". This means that the kernel will try to find the memory using a pile of free memory set aside for urgent allocation. If that pile doesn't have enough free pages, the operation will fail. This flag is useful for allocation within interrupt handlers.
GFP_KERNEL will try a little harder to find memory. There's a possibility that the call to kmalloc() will sleep while the kernel is trying to find memory (thus making it unsuitable for interrupt handlers). It's much more rare for an allocation with GFP_KERNEL to fail than with GFP_ATOMIC. In all cases, kmalloc() should only be used allocating small amounts of memory (a few kb). vmalloc() is better for larger amounts. Regards sanjeev sharma On Thu, Apr 2, 2009 at 8:49 PM, Peter Teoh <htmldevelo...@gmail.com> wrote: > On Thu, Apr 2, 2009 at 8:46 AM, Lal <learner.ker...@gmail.com> wrote: > > On Tue, Mar 31, 2009 at 2:03 PM, nidhi mittal <nidhimitta...@gmail.com> > wrote: > >> hi > >> i have written a very simple ram based block device driver > >> processing request asynchronously > >> > >> wherein > >> in request function -- dequeue the req from req queue and add it to the > >> linked list > >> then in the function triggered by timer > >> handle each req from the linked list > >> then blk_end_requets is called upon completion of request . > >> > >> > > > >> blkdev_dequeue_request(req); > >> my_req = (struct filtered_request*)kzalloc(sizeof(struct > >> filtered_request),GFP_KERNEL); > > > > In request function, you should use GFP_ATOMIC > > > > this is new to me, can i know why it should be GFP_ATOMIC? > > > -- > Regards, > Peter Teoh > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecar...@nl.linux.org > Please read the FAQ at http://kernelnewbies.org/FAQ > >