public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Oliver Neukum <oliver@neukum.name>
Cc: Muli Ben-Yehuda <mulix@mulix.org>, linux-kernel@vger.kernel.org
Subject: Re: question on context of kfree_skb()
Date: Tue, 31 Dec 2002 10:31:51 +0100	[thread overview]
Message-ID: <3E116407.6040802@colorfullife.com> (raw)
In-Reply-To: <200212310157.06624.oliver@neukum.name>

Oliver Neukum wrote:

>Am Montag, 30. Dezember 2002 23:32 schrieb Manfred Spraul:
>  
>
>>Mulix wrote:
>>    
>>
>>>dev_kfree_skb_any() should be called when you could be either
>>>executing in interrupt context or not.
>>>      
>>>
>>dev_kfree_skb_any() can misdetect the context: You must not use the
>>function if you hold an irq spinlock and you might be running from BH or
>>process context.
>>    
>>
>
>What then shall be used under these circumstances ?
>Could you perhaps summarise the issue ?
>  
>
When a packet is freed, the upper layers must be notified, for example a 
user space process could be waiting for socket buffer space. This can 
happen either immediately, or in the next softirq.

dev_kfree_skb_irq() is always ok, although slower than the other 
functions. The packet is unconditionally queued and processed later.
dev_kfree_skb_any() tries to optimize it a bit: If it thinks that it's 
save to process it now, then the packet is processed immediately. The 
autodetection is usually correct, except for the special case I 
mentioned. Drivers must work around that.
dev_kfree_skb() always processes the packet immediately. Only permitted 
from bottom half context or from process context.

--
    Manfred


  reply	other threads:[~2002-12-31  9:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-30 22:32 question on context of kfree_skb() Manfred Spraul
2002-12-31  0:57 ` Oliver Neukum
2002-12-31  9:31   ` Manfred Spraul [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-12-30 18:32 Oliver Neukum
2002-12-30 22:26 ` Muli Ben-Yehuda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E116407.6040802@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mulix@mulix.org \
    --cc=oliver@neukum.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox