Messages in this thread | | | Date | Sat, 31 Jan 1998 10:32:20 -0500 | From | Bill Hawes <> | Subject | Re: 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
| |