From patchwork Mon Jan 7 15:32:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 209952 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 239C82C0087 for ; Tue, 8 Jan 2013 02:32:16 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753283Ab3AGPcJ (ORCPT ); Mon, 7 Jan 2013 10:32:09 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:60795 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753068Ab3AGPcI (ORCPT ); Mon, 7 Jan 2013 10:32:08 -0500 X-IronPort-AV: E=Sophos;i="4.84,424,1355097600"; d="scan'208";a="2707455" Received: from ftlpex01cl01.citrite.net ([10.13.107.78]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/AES128-SHA; 07 Jan 2013 15:32:06 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.318.1; Mon, 7 Jan 2013 10:32:06 -0500 Received: from cosworth.uk.xensource.com ([10.80.16.52] ident=ianc) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1TsEgI-00074a-72; Mon, 07 Jan 2013 15:32:06 +0000 From: Ian Campbell To: CC: Ian Campbell , Sander Eikelenboom , Konrad Rzeszutek Wilk , annie li , Subject: [PATCH V2] xen/netfront: improve truesize tracking Date: Mon, 7 Jan 2013 15:32:06 +0000 Message-ID: <1357572726-7059-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.2.5 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Using RX_COPY_THRESHOLD is incorrect if the SKB is actually smaller than that. We have already accounted for this in NETFRONT_SKB_CB(skb)->pull_to so use that instead. Fixes WARN_ON from skb_try_coalesce. Signed-off-by: Ian Campbell Cc: Sander Eikelenboom Cc: Konrad Rzeszutek Wilk Cc: annie li Cc: xen-devel@lists.xen.org Cc: netdev@vger.kernel.org Cc: stable@kernel.org # 3.7.x only Acked-by: Eric Dumazet --- v2: - acount frags as a full page as recommended by Eric. --- drivers/net/xen-netfront.c | 27 ++++----------------------- 1 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index caa0110..b518538 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -959,29 +959,10 @@ err: i = xennet_fill_frags(np, skb, &tmpq); /* - * Truesize approximates the size of true data plus - * any supervisor overheads. Adding hypervisor - * overheads has been shown to significantly reduce - * achievable bandwidth with the default receive - * buffer size. It is therefore not wise to account - * for it here. - * - * After alloc_skb(RX_COPY_THRESHOLD), truesize is set - * to RX_COPY_THRESHOLD + the supervisor - * overheads. Here, we add the size of the data pulled - * in xennet_fill_frags(). - * - * We also adjust for any unused space in the main - * data area by subtracting (RX_COPY_THRESHOLD - - * len). This is especially important with drivers - * which split incoming packets into header and data, - * using only 66 bytes of the main data area (see the - * e1000 driver for example.) On such systems, - * without this last adjustement, our achievable - * receive throughout using the standard receive - * buffer size was cut by 25%(!!!). - */ - skb->truesize += skb->data_len - RX_COPY_THRESHOLD; + * Truesize is the actual allocation size, even if the + * allocation is only partially used. + */ + skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags; skb->len += skb->data_len; if (rx->flags & XEN_NETRXF_csum_blank)