Re: GFP_ATOMIC vs GFP_KERNEL in netfilter module

From: Robert Love (rml_at_novell.com)
Date: 12/03/04

  • Next message: Alan Cox: "Re: dma errors with sata_sil and Seagate disk"
    To: Roberto Jung Drebes <drebes@inf.ufrgs.br>
    Date:	Thu, 02 Dec 2004 19:31:49 -0500
    
    

    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@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Alan Cox: "Re: dma errors with sata_sil and Seagate disk"

    Relevant Pages

    • RE: RE[PATCH]2.6.5-rc2 MSI Support for IA64
      ... We are thinking of replacing the semantics of assign_irq_vector ... of vectors currently avaiable in the system for any new allocations, ... Regarding your example, the last assigned vector is 0x39, the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: will the memory allocated by malloc get released when program exits?
      ... >> Of course I will free the memory in my code. ... many allocations, I don't know the exact reason though. ... I have noticed similar delay in my program (where I allocate large ... it took astonishingly long (process real time was significantly ...
      (comp.lang.c)
    • Re: [PATCH]: Clean up of __alloc_pages
      ... > This is not only the cpuset check. ... If there is memory available in an ... indicate allocations to come from current node only. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: select() for delay.
      ... > three sets empty, n zero, and a non-null timeout as a fairly portable ... > This patch improves the sys_selectexecution when used for delay. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: HP Proliant ML350 kernel panic
      ... Sorry for the long delay... ... > The kernel panic is intermittent. ... > boot time, but it will reoccur randomly while the machine is up and ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)