From: Jon Maloy <jon.ma...@ericsson.com> 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 <hoang.h...@dektek.com.au> > Acked-by: Ying Xue <ying....@windriver.com> > Signed-off-by: Jon Maloy <jon.ma...@ericsson.com> 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.