netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: jon.maloy@ericsson.com
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
Subject: Re: [net-next v2 1/1] tipc: avoid unnecessary copying of bundled messages
Date: Fri, 16 Feb 2018 15:32:42 -0500 (EST)	[thread overview]
Message-ID: <20180216.153242.812854511264084636.davem@davemloft.net> (raw)
In-Reply-To: <1518700477-30667-1-git-send-email-jon.maloy@ericsson.com>

From: Jon Maloy <jon.maloy@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.le@dektek.com.au>
> Acked-by: Ying Xue <ying.xue@windriver.com>
> Signed-off-by: Jon Maloy <jon.maloy@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.

  reply	other threads:[~2018-02-16 20:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 13:14 [net-next v2 1/1] tipc: avoid unnecessary copying of bundled messages Jon Maloy
2018-02-16 20:32 ` David Miller [this message]
2018-02-17 20:13   ` Jon Maloy
2018-02-19 13:29   ` David Laight
2018-02-19 17:19     ` Jon Maloy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180216.153242.812854511264084636.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=canh.d.luu@dektech.com.au \
    --cc=hoang.h.le@dektech.com.au \
    --cc=jon.maloy@ericsson.com \
    --cc=mohan.krishna.ghanta.krishnamurthy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=tung.q.nguyen@dektech.com.au \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).