Lets say we have device mobile and we start an application ,our application connects to our driver and in driver level lets say we allocate some memory using kmalloc with flag=GFP_KERNEL ,now if memory allocation fail in each time so what will be our application behaviour,will it run or will crash ,how memory issue will resolve and what are the likely cause of failure? Secondly ,if I put into different way like suppose ,I use kmalloc in ISR then again lets say our memory allocation fail (with some reason) then what are the issues we have to address and Will our application crash or we just flash “memory fail switch off your mobile ….”


If ever the memory allocation fails @ kernel level, the corresponding routine/function must have an error checking condition which would return -ENOMEM. Everytime , in a driver, if you use kmalloc, check its error condition , and return the corresponding value in application. rest of the thing depends on how application is programmed to react at returning of a system call.
In ISR, use GFP_ATOMIC.