From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752171AbaEVU6T (ORCPT ); Thu, 22 May 2014 16:58:19 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:62115 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbaEVU6R (ORCPT ); Thu, 22 May 2014 16:58:17 -0400 Message-ID: <1400792295.5367.174.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: skbuff truesize incorrect. From: Eric Dumazet To: Jim Baxter Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "netdev@vger.kernel.org" , "David S. Miller" , kamal@canonical.com, Ben Hutchings , edumazet@google.com, mszeredi@suse.cz, fw@strlen.de Date: Thu, 22 May 2014 13:58:15 -0700 In-Reply-To: <537E4AFD.20304@mentor.com> References: <537E4AFD.20304@mentor.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2014-05-22 at 20:07 +0100, Jim Baxter wrote: > > I have been investigating a network issue with bursts of network traffic > over USB CDC-NCM, the issue is that the kernel is dropping packets > because sk_rcvqueues_full() returns true due to skb2->truesize is always > 32960 instead of SKB_TRUESIZE(skb2->len) which is about 1800. > > The code I am trying to fix is this code below, it is splitting a set of > multiple network packets compressed into a single 16k packet into > individual skb's and sending them up the network stack. if skb are allocated with 16k = 16384 bytes, adding the struct skb_shared_info overhead and rounding up to power of two gives 32768 bytes. Chances to be able to allocate 32KB contiguous memory are slim after a while. I would set rx_max (rx_urb_size) to SKB_MAX_HEAD(0) so that you do not use high order allocations. What is the exact 'overhead' using ~4K instead of 16K exactly on this hardware ?