GFP_ATOMIC vs GFP_KERNEL in netfilter module
rml at novell.com
Fri Dec 3 01:31:49 CET 2004
On Thu, 2004-12-02 at 21:12 -0200, Roberto Jung Drebes wrote:
> If I use GFP_KERNEL with the kmallocs, I get errors like
So don't use GFP_KERNEL; use GFP_ATOMIC. You cannot sleep in netfilter
hooks, since they are run in interrupt context (when the packet is
received) by the net_rx_action softirq. You can see this in your stack
> If I use GFP_ATOMIC, I don't get the error, but I think timers are not
> being called after the delay. I have a similar code for transmition,
> which works OK with GFP_KERNEL (delays messages) but with GFP_ATOMIC it
> does also not delay.
If you have problems with GFP_ATOMIC, the problem is elsewhere and not
in the fact that your allocations are atomic versus not.
First thing, though, check the return value from kmalloc for failure (dp
and tl equal NULL) to ensure that the allocation is even working!
More information about the netfilter-devel