Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753914Ab1FEFNb (ORCPT ); Sun, 5 Jun 2011 01:13:31 -0400 Received: from mail-yi0-f46.google.com ([209.85.218.46]:51529 "EHLO mail-yi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996Ab1FEFN3 (ORCPT ); Sun, 5 Jun 2011 01:13:29 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=bFba/T5lQnyRxkBjWCtd2yIYxmlybXNI3838wxnOm6qe89SR39xJOIo/an4/TbB9DA 5nyHcWokZB7AYTVyH3XkYuiP9EEPCNn0cdYdVP6crmpQX/I4hrpQUO9OcM/Jow8BgSYX +ZGHSVikq7CuK99A9yCSfHTMlrs0CcyBNGDkw= MIME-Version: 1.0 In-Reply-To: <4DEA5D78.5030402@centrum.cz> References: <4DEA5D78.5030402@centrum.cz> Date: Sun, 5 Jun 2011 13:13:28 +0800 Message-ID: Subject: Re: ETH over USB: NFS state (seeking ARM platform for NFS-based builds) From: Ming Lei To: Karel Gardas Cc: linux-kernel@vger.kernel.org, linux-usb , Network Development Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2467 Lines: 83 Hi, 2011/6/5 Karel Gardas : > Hello, > > while searching for ARMv7/NEON platform for my own hacking I've found this > interesting issue: > > [ 2945.114135] cc1: page allocation failure. order:3, mode:0x4020 Maybe the patch below can fix the issue, please try it: diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 9ab439d..f16e448 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -324,12 +324,20 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) unsigned long lockflags; size_t size = dev->rx_urb_size; - if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) { - netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); + if (atomic_read(&dev->rx_skb_on_fly) > MAX_RX_SKB_ON_FLY && + flags == GFP_ATOMIC) { + netif_dbg(dev, rx_err, dev->net, "too many rx skbs on the fly\n"); +fail_rx_memory: usbnet_defer_kevent (dev, EVENT_RX_MEMORY); usb_free_urb (urb); return -ENOMEM; } + + if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) { + netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); + goto fail_rx_memory; + } + atomic_inc(&dev->rx_skb_on_fly); skb_reserve (skb, NET_IP_ALIGN); entry = (struct skb_data *) skb->cb; @@ -375,6 +383,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) } spin_unlock_irqrestore (&dev->rxq.lock, lockflags); if (retval) { + atomic_dec(&dev->rx_skb_on_fly); dev_kfree_skb_any (skb); usb_free_urb (urb); } @@ -1177,8 +1186,9 @@ static void usbnet_bh (unsigned long param) entry->state = rx_cleanup; rx_process (dev, skb); continue; - case tx_done: case rx_cleanup: + atomic_dec(&dev->rx_skb_on_fly); + case tx_done: usb_free_urb (entry->urb); dev_kfree_skb (skb); continue; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 605b0aa..1dace0d 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -33,6 +33,8 @@ struct usbnet { wait_queue_head_t *wait; struct mutex phy_mutex; unsigned char suspend_count; + atomic_t rx_skb_on_fly; +# define MAX_RX_SKB_ON_FLY 2048 /* i/o info: pipes etc */ unsigned in, out; thanks, -- Ming Lei -- 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/