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 1/1] tipc: avoid unnecessary copying of bundled messages
Date: Fri, 16 Feb 2018 15:25:31 -0500 (EST) [thread overview]
Message-ID: <20180216.152531.1216065970863609106.davem@davemloft.net> (raw)
In-Reply-To: <BN6PR15MB1553F7630C04A6334168AE9C9AF40@BN6PR15MB1553.namprd15.prod.outlook.com>
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Thu, 15 Feb 2018 08:57:14 +0000
> The buffers we are cloning are linearized 1 MTU incoming
> buffers. There are no fragments. Each clone normally points to only
> a tiny fraction of the data area of the base buffer. I don't claim
> that copying always is bad, but in this case it happens in the
> majority of cases, and as I see it completely unnecessarily.
>
> There is actually some under accounting, however, since we now only
> count the data area of the base buffer (== the sum of the data area
> of the clones) plus the overhead of the clones. A more accurate
> calculation, taking into account even the overhead of the base
> buffer, would look like this: (*iskb)->truesize = SKB_TRUSIZE(imsz)
> + (skb->truesize - skb->len) / msg_msgcnt(msg);
>
> I.e., we calculate the overhead of the base buffer and divide it
> equally among the clones. Now I really can't see we are missing
> anything.
Maybe there is some miscommunication between us. Let me try using
different words.
I you have a single SKB which has a truesize of, say, 10K and then you
clone this several times to point the SKB into small windows into that
original SKB's buffer, then you must use the same 10K truesize for the
clones that you did for the original SKB.
It absolutely does not matter that the clones are only pointing to a
small part of the original SKB's buffer. Until they are freed up each
individual SKB still causes that _ENTIRE_ buffer to be held up and not
freeable.
This is why you have to be careful how you manage SKBs, and in fact
what you are doing by cloning and constricting the data pointers, is
actually troublesome and you can see this with the truesize problems
you are running into.
SKBs are really not built to be managed like this.
prev parent reply other threads:[~2018-02-16 20:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 12:50 [net-next 1/1] tipc: avoid unnecessary copying of bundled messages Jon Maloy
2018-02-14 13:42 ` Eric Dumazet
2018-02-14 20:27 ` David Miller
2018-02-15 8:57 ` Jon Maloy
2018-02-16 20:25 ` David Miller [this message]
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.152531.1216065970863609106.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).