Re: [PATCH 7/9] net: add skb_orphan_frags to copy aside frags with destructors
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2012-05-03 21:10:21
On Thu, May 03, 2012 at 01:55:32PM -0400, David Miller wrote:
From: "Michael S. Tsirkin" <mst@redhat.com> Date: Thu, 3 May 2012 18:41:43 +0300quoted
On Thu, May 03, 2012 at 03:56:09PM +0100, Ian Campbell wrote:quoted
This should be used by drivers which need to hold on to an skb for an extended (perhaps unbounded) period of time. e.g. the tun driver which relies on userspace consuming the skb. Signed-off-by: Ian Campbell <redacted> Cc: mst@redhat.comRight. But local sockets queue at socket forever as well. I think this should be called in skb_set_owner_r? This might somewhat penalize speed for local clients in the name of correctness but these are rare so being correct is more important I think.But, on the other hand, putting the check into skb_set_owner_r() is a not so nice test to have in the fast path of every socket receive.
True. Hmm we orphan skbs when we loop them back so how about reusing the skb->destructor for this? We could teach pskb_copy pskb_expand_head etc that when skb with this flag is cloned (expand head etc) destructor would be set to a function that copies frags. (clone is less of a fast path so I think adding a branch there is less of an issue). Of course destructor is also called from kfree_skb but we could clear this flag before the call in kfree_skb so that destructor can distinguish. -- MST