Re: [PATCH 1/4 net-next] net: allow skb->head to be a page fragment
From: Li Yu <hidden>
Date: 2012-11-08 07:47:28
于 2012年11月07日 19:04, Eric Dumazet 写道:
On Wed, 2012-11-07 at 16:35 +0800, Li Yu wrote:quoted
于 2012年11月07日 16:20, Li Yu 写道:quoted
于 2012年04月27日 18:33, Eric Dumazet 写道:quoted
From: Eric Dumazet <edumazet@google.com> skb->head is currently allocated from kmalloc(). This is convenient but has the drawback the data cannot be converted to a page fragment if needed.Hi, Eric, I have a question about this patch, why data are allocated from kmalloc() can not be converted to page fragment ? We have its kernel mapped address and length, so we can get its page and offset in the page. If the skb is not cloned (shared with others), such page and its offset should be can use safely, in my words. I suspected that I may lost important something in slab internals, is right? Thanks YuOr since slab allocated object may be across multiple pages? I saw __netdev_alloc_skb() only use build_skb() with non-zero fragsz if it is less than PAGE_SIZE.SLAB allocators have their own way to handle a page, we cant interfere with it. So no, a kmalloced() object cannot be converted to a page fragment.
I think that all kmalloced() objects are continuous on both virtual and physical address space, so such page fragment converting should be safe until we use slab allocator to free them. I ask this question since I am working on a patch to try to directly forward the data from rx queue of a socket to tx queue of another socket. We noticed that the splice itself still has visible costs when forwarding small messages, and hope such direct forwarding optimization can improve this, this idea comes from TCP friends. Thanks Yu