Re: GFP_ATOMIC vs GFP_KERNEL in netfilter module

From: Robert Love
Date: Thu Dec 02 2004 - 19:31:45 EST


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
trace.

> 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!

Robert Love


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/