Re: GFP_ATOMIC in ipw_rx_queue_replenish

Zhu Yi <[email protected]> Wed, 10 Dec 2008 13:20:34 +0800
Newsgroups gmane.linux.drivers.ipw2100.devel
Organization Intel Corp.
Message-ID <[email protected]>
On Sun, 2008-12-07 at 02:19 +0800, Pierre-Alexandre Meyer wrote:
> Good morning,
> 
> I was wondering if it is safe to sleep in ipw_rx_queue_replenish()?
> 
> When resuming from suspend to disk for instance, when memory contention
> is high, if alloc_skb() fails, it will eventually dump_stack() and
> show_mem().
> 
> The error is not fatal but I was wondering if the GFP_ATOMIC is needed.
> 
> If not, please consider the following patch:
> 
> Signed-off-by: Pierre-Alexandre Meyer <[email protected]>
> 
> diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
> index dcce354..e5c825b 100644
> --- a/drivers/net/wireless/ipw2200.c
> +++ b/drivers/net/wireless/ipw2200.c
> @@ -5134,7 +5134,7 @@ static void ipw_rx_queue_replenish(void *data)
>         while (!list_empty(&rxq->rx_used)) {
>                 element = rxq->rx_used.next;
>                 rxb = list_entry(element, struct ipw_rx_mem_buffer, list);
> -               rxb->skb = alloc_skb(IPW_RX_BUF_SIZE, GFP_ATOMIC);
> +               rxb->skb = alloc_skb(IPW_RX_BUF_SIZE, GFP_KERNEL);
>                 if (!rxb->skb) {
>                         printk(KERN_CRIT "%s: Can not allocate SKB buffers.\n",
>                                priv->net_dev->name);

No, this is in the atomic context. See the spin_lock_irqsave(&rxq->lock,
flags) above.

Thanks,
-yi


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/