[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AANLkTinXxyVzvPWT_nnpos4-tVVj68T+7iHCvokHG+2m@mail.gmail.com>
Date: Sat, 11 Sep 2010 08:19:39 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Oliver Hartkopp <socketcan@...tkopp.net>,
"Michael S. Tsirkin" <mst@...hat.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] net: af_packet: don't call tpacket_destruct_skb() until
the skb is sent out
On Sat, Sep 11, 2010 at 1:12 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> Le vendredi 10 septembre 2010 à 18:58 +0200, Eric Dumazet a écrit :
>> Le samedi 11 septembre 2010 à 00:47 +0800, Changli Gao a écrit :
>> > On Fri, Sep 10, 2010 at 10:26 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>>
>>
>> > > Are you sure sock_wfree(skb) is still needed ?
>> >
>> > sock_wfree(skb) is also used to wake up the users who sleep on
>> > poll(2). If sock_wfree(skb) is moved into skb->destructor(), and
>> > called before skb is sent out, pollers will be waked up without
>> > POLLOUT, and since the later skb_shinfo(skb)->destructor() doesn't
>> > wake up the pollers, POLLOUT events will be lost, and the poller will
>> > be blocked forever.
>> >
>>
>> Then implement poll() to use the number of available slots.
>> (not use the default poll() that relies on generic sk / inet queues and
>> counters)
>>
>> Really, sock_wfree() cannot be used at all, or we also must disable
>> early orphaning of these skbs.
>>
>> Goal is to replace skb->destructor use in af_packet by
>> shinfo->destructor, not mix the two.
>
> Thinking again about this, we also might avoid taking references on
> pages and releasing references too.
>
> shinfo->destructor should replace the skb_release_data() logic,
> not complement it.
>
> if (shinfo->destructor) {
> shinfo->destructor(skb);
> } else {
> for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
> put_page(skb_shinfo(skb)->frags[i].page);
> if (skb_has_frag_list(skb))
> ....
> kfree(skb->head);
> }
>
>
> As long as the mmap zone is correctly protected in af_packet code, of
> course (not releasing it as long as some packets are still in flight)
>
It touches too much internal implementation.
I think most of your ideas are about optimizations, and should be
addressed in separate patches. I'll avoid kmalloc/kfree in the next
version. Thanks.
--
Regards,
Changli Gao(xiaosuo@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists