> -----Original Message-----
> From: Ying Xue [mailto:[email protected]]
> Sent: Wednesday, February 14, 2018 08:17
> To: Jon Maloy <[email protected]>; Jon Maloy
> <[email protected]>
> Cc: Mohan Krishna Ghanta Krishnamurthy
> <[email protected]>; Tung Quang Nguyen
> <[email protected]>; Hoang Huu Le
> <[email protected]>; Canh Duc Luu
> <[email protected]>; [email protected]; [email protected];
> [email protected]
> Subject: Re: [net-next 01/24] tipc: avoid unnecessary copying of bundled
> messages
> 
> On 02/10/2018 01:07 AM, Jon Maloy wrote:
> > +
> > +   /* Scale extracted buffer's truesize down to original size */
> > +   mcnt = msg_msgcnt(msg);
> > +   (*iskb)->truesize = SKB_TRUESIZE(imsz) + skb->truesize / mcnt;
> 
> skb->truesize not only includes the length of original skb real data
> size, but also it contains the length of original skb buffer's overhead.
> 
> In our change, SKB_TRUESIZE(imsz) represents the real data length of one
> bundled message plus the cache alignment size, and "skb->truesize / mcnt"
> also contains the real data length of one bundled message.
> Therefore, as per my understanding, it seems we repeatedly counted real
> data length.

You are right about that. We end up with double accounting of the data length, 
which is not good.

> 
> In my opinion, (*iskb)->truesize = SKB_TRUESIZE(imsz) is sufficient.

But this way, we only count the overhead and data length of the clone, and miss 
the overhead of the base  buffer.

Thinking through this again, I think a fully correct calculation would look 
like this:

(*iskb)->trusize = SKB_TRUESIZE(imsz) + (skb->truesize - msg_size(msg)) /msgcnt;

///jon


> 
> Please confirm whether my understanding is right.
> 
> >     if (unlikely(!tipc_msg_validate(iskb)))
> >             goto none;
> >     *pos += align(imsz);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to