Allocation Flags for Kernel Memory
Every kernel allocation carries a flag telling the memory system what it is allowed to do to find the memory. The ordinary flag permits the allocator to wait, swap and free other things, which means it may sleep and so is only legal in normal context; the atomic flag forbids waiting and may fail more often, and is what you must use inside an interrupt handler or while holding a spinlock. Other flags ask for zeroed memory or for a physically contiguous region. Passing the sleeping flag from an interrupt handler is a real and well-known way to deadlock a machine.
Questions this Concept answers
- Why can an allocation made with `GFP_KERNEL` put the calling thread to sleep?
How Does GFP_KERNEL Differ from GFP_ATOMIC? - Best Linux Device Drivers Training in Hyderabad
This page explains the flag that every kernel memory allocation carries to tell the allocator what it is allowed to do while finding memory. The ordinary flag lets the allocator wait, reclaim and swa…