From: "Jan Beulich" Subject: [PATCH] linux: Adjust memory allocation condition in netback Date: Mon, 12 Mar 2007 14:28:03 +0000 Message-ID: <45F57183.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org .. to reduce memory pressure on Xen and avoid unnecessarily stalling receives. Signed-off-by: Jan Beulich Index: head-2007-02-27/drivers/xen/netback/netback.c =================================================================== --- head-2007-02-27.orig/drivers/xen/netback/netback.c 2007-03-01 15:23:00.000000000 +0100 +++ head-2007-02-27/drivers/xen/netback/netback.c 2007-03-12 09:26:17.000000000 +0100 @@ -110,6 +110,7 @@ static unsigned int alloc_index = 0; static inline unsigned long alloc_mfn(void) { + BUG_ON(!alloc_index); return mfn_list[--alloc_index]; } @@ -552,6 +553,7 @@ static void net_rx_action(unsigned long *(int *)skb->cb = nr_frags; if (!xen_feature(XENFEAT_auto_translated_physmap) && + !((netif_t *)netdev_priv(skb->dev))->copying_receiver && check_mfn(nr_frags + 1)) { /* Memory squeeze? Back off for an arbitrary while. */ if ( net_ratelimit() )