lkml.org 
[lkml]   [1998]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: alloc_skb called nonatomically from interrupt.. 2.1.84
David S. Miller wrote:

> net_foo()
> {
> /* We run from user context, but need to protect
> * against incoming packet handling code...
> */
> start_bh_atomic();
> ...
> /* This now doesn't work with the current code... */
> skb = alloc_skb(size, GFP_KERNEL);
> ...
> end_bh_atomic();
> }
>
> won't work anymore...
>
> A lot of pieces of code do things like this, start a BH atomic from
> base level code and call something which can only legitimately run
> from non-IRQ code under certain circumstances.

Hi David,

I'm a little puzzled as to what semantics you would expect for a snippet of code
as above. Surely you wouldn't really expect to disable bh for the duration of a
call that might require an arbitrary amount of time for swapping, etc? So if it
means "don't run any bh if you can get the memory without swapping, but
otherwise it's OK", then after the call returns you won't know whether it was bh
atomic or not.

If it's really important for you to do the processing bh atomically, then you
probably need a different strategy to get the memory, such as allocating it in
advance.

Regards,
Bill

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.066 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site