From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [net-next v2 1/1] tipc: avoid unnecessary copying of bundled messages Date: Fri, 16 Feb 2018 15:32:42 -0500 (EST) Message-ID: <20180216.153242.812854511264084636.davem@davemloft.net> References: <1518700477-30667-1-git-send-email-jon.maloy@ericsson.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, mohan.krishna.ghanta.krishnamurthy@ericsson.com, tung.q.nguyen@dektech.com.au, hoang.h.le@dektech.com.au, canh.d.luu@dektech.com.au, ying.xue@windriver.com, tipc-discussion@lists.sourceforge.net To: jon.maloy@ericsson.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:58610 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbeBPUco (ORCPT ); Fri, 16 Feb 2018 15:32:44 -0500 In-Reply-To: <1518700477-30667-1-git-send-email-jon.maloy@ericsson.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Jon Maloy Date: Thu, 15 Feb 2018 14:14:37 +0100 > A received sk buffer may contain dozens of smaller 'bundled' messages > which after extraction go each in their own direction. > > Unfortunately, when we extract those messages using skb_clone() each > of the extracted buffers inherit the truesize value of the original > buffer. Apart from causing massive overaccounting of the base buffer's > memory, this often causes tipc_msg_validate() to come to the false > conclusion that the ratio truesize/datasize > 4, and perform an > unnecessary copying of the extracted buffer. > > We now fix this problem by explicitly correcting the truesize value of > the buffer clones to be the truesize of the clone itself plus a > calculated fraction of the base buffer's overhead. This change > eliminates the overaccounting and at least mitigates the occurrence > of unnecessary buffer copying. > > Reported-by: Hoang Le > Acked-by: Ying Xue > Signed-off-by: Jon Maloy As I explained in my previous two emails, I don't think this method of accounting is appropriate. All of your clones must use the same skb->truesize as the original SKB because each and every one of them keeps the full buffer from being liberated until they are released.