Skip to contentSkip to conversation

PATCH zero-copy send completion callback

DISCUSSION Eric Barton 4 participants 5 messages Oct 17, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

David,

Quoted 2 lines

Also, the correct mailing list to get to the networking developers is [email protected]. "linux-net" is for users.

Noted.

Quoted 4 lines

Finally, I very much doubt you have much chance getting this change in, the infrastructure is implemented in a very ad-hoc fashion and it takes into consideration none of the potential other users of such a thing.

Are you referring to the absence of a callback argument other than the callback descriptor itself? It seemed natural to me to contain the descriptor in whatever state the higher-level protocol associates with the message it's sending, and to derive this from the descriptor address in the callback.

If this isn't what you mean, could you explain? I'm not at all religious about it.

Quoted 3 lines

And these days we're trying to figure
out how to eliminate skbuff and skb_shared_info struct members whereas you're adding 16-bytes of space on 64-bit platforms.

Do you think the general concept of a zero-copy completion callback is useful?

If so, do you have any ideas about how to do it more economically? It's 2 pointers rather than 1 to avoid forcing an unnecessary packet boundary between successive zero-copy sends. But I guess that might not be hugely significant since you're generally sending many pages when zero-copy is needed for performance. Also, (please correct me if I'm wrong) I didn't think this would push the allocation over to the next entry in 'malloc_sizes'.

Cheers,
Eric

#2 lore raw
Quoted 7 lines · Eric Barton

If so, do you have any ideas about how to do it more economically? It's 2 pointers rather than 1 to avoid forcing an unnecessary packet boundary between successive zero-copy sends. But I guess that might not be hugely significant since you're generally sending many pages when zero-copy is needed for performance. Also, (please correct me if I'm wrong) I didn't think this would push the allocation over to the next entry in 'malloc_sizes'.

Well, skbuff heads are allocated from dedicated kmem_cache (skbuff_fclone_cache & skbuff_head_cache), and these caches are not constrained by the sizes available in malloc_sizes. Their size are a multiple of L1 CACHE size, which is 64 bytes for most common machines.

Even if your two pointers addition (16 bytes on x86_64) doesnt cross a 64bytes line (I didn't checked), they are going to be set to NULL each time a skbuff is allocated , and checked against NULL each time a skbuff is destroyed.

Eric

#5 lore raw
In reply to Eric Barton
Quoted 6 lines · Eric Barton
Quoted 3 lines

And these days we're trying to figure
out how to eliminate skbuff and skb_shared_info struct members whereas you're adding 16-bytes of space on 64-bit platforms.

Do you think the general concept of a zero-copy completion callback is useful?

You can use existing skb destructor and appropriate reference counter is already there. In your own destructor you need to call old one of course, and it's type can be determined from the analysis of the headers and skb itself (there are not so much destructor's types actually). If that level of abstraction is not enough, it is possible to change skb_release_data()/__kfree_skb() so that it would be possible in skb->destructor() to determine if attached pages will be freed or not.

Quoted 4 lines

If so, do you have any ideas about how to do it more economically? It's 2 pointers rather than 1 to avoid forcing an unnecessary packet boundary between successive zero-copy sends. But I guess that might not be hugely significant since you're generally sending many pages when zero-copy is

Existing sendfile() implementation is synchronous, it does not require async callback. It looks like lustre sets number of pages to be sent asyncrhonously and report to user that everything is ok, and when appropriate callback is invoked, it updates it's metadata? Fair enough, it looks similar to VFS cache in case of usual write.

Quoted 3 lines

needed for performance. Also, (please correct me if I'm wrong) I didn't think this would push the allocation over to the next entry in 'malloc_sizes'.

skbs are allocated from own cache, and the smaller it is, the better.

Quoted 2 lines

Cheers,
Eric

Signature · 1 line
	Evgeniy Polyakov
#3 lore raw
In reply to Eric Dumazet
Quoted 9 lines
Quoted 3 lines

Also, (please correct me if I'm wrong) I didn't think this would push the allocation over to the next entry in 'malloc_sizes'.

Well, skbuff heads are allocated from dedicated kmem_cache (skbuff_fclone_cache & skbuff_head_cache), and these caches are not constrained by the sizes available in malloc_sizes. Their size are a multiple
of L1 CACHE size, which is 64 bytes for most common machines.

Indeed, struct skbuff is so allocated. But I added the callback pointers to struct skb_shared_info where the page pointers are stored, and this struct is allocated along with the packet header using kmalloc.

Quoted 6 lines

Even if your two pointers addition (16 bytes on x86_64) doesnt cross a 64bytes
line (I didn't checked), they are going to be set to NULL each time a skbuff
is allocated , and checked against NULL each time a skbuff is destroyed.

Indeed. Do you think that's significant?

Cheers,
Eric

---------------------------------------------------

|Eric Barton        Barton Software               |
|9 York Gardens     Tel:    +44 (117) 330 1575    |
|Clifton            Mobile: +44 (7909) 680 356    |
|Bristol BS8 4LL    Fax:    call first            |
|United Kingdom     E-Mail: [email protected]|

---------------------------------------------------

maintainer
#4 lore raw

From: "Eric Barton" <[email protected]>
Date: Tue, 17 Oct 2006 13:23:10 +0100

Quoted 8 lines
Quoted 6 lines

Even if your two pointers addition (16 bytes on x86_64) doesnt cross a 64bytes
line (I didn't checked), they are going to be set to NULL each time a skbuff
is allocated , and checked against NULL each time a skbuff is destroyed.

Indeed. Do you think that's significant?

On a machine routing a million packets per second, it definitely is. It is the most crucial data structure for performance in all of the networking.