[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1400594349.5367.114.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Tue, 20 May 2014 06:59:09 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Jason Wang <jasowang@...hat.com>
Cc: Xi Wang <xii@...gle.com>, "David S. Miller" <davem@...emloft.net>,
netdev@...r.kernel.org, "Michael S. Tsirkin" <mst@...hat.com>,
Maxim Krasnyansky <maxk@....qualcomm.com>,
Neal Cardwell <ncardwell@...gle.com>,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH v2] net-tun: restructure tun_do_read for better
sleep/wakeup efficiency
On Tue, 2014-05-20 at 14:03 +0800, Jason Wang wrote:
> On 05/20/2014 01:11 PM, Eric Dumazet wrote:
> > On Tue, 2014-05-20 at 12:44 +0800, Jason Wang wrote:
> >> On 05/19/2014 10:09 PM, Eric Dumazet wrote:
> >>> About the sk_data_ready() and wake_up_all(), you missed the whole part
> >>> of the patch I think.
> >>>
> >>> Check how sock_def_readable() does everything properly and efficiently,
> >>> including the async part.
> >> But this changes (sk_data_ready()) has nothing related to switching to
> >> use __skb_recv_datagram()
> >>
> > This is totally related.
> >
> > I think you did not yet understood this patch
>
> Sorry for being unclear, but I think you misunderstand my meaning.
> >
> > Compare wake_up_all() and sk_data_ready() speeds, you'll be surprised.
> >
> > You should ask to yourself : Why do we use wq_has_sleeper() in
> > networking stacks ?
>
> See my first reply, I don't have objection that uses sk_data_ready() in
> tun_net_xmit(). My only concern is using sk_data_ready() in
> tun_detach_all():
>
> - It was only called during tun destroying, so I believe we don't care
> about the performance in this condition.
Its there for symmetry, and so far our tests just work.
Have you run into any problems ?
> - sk_data_ready() was usually called when there's something new to be
> processed which is not case in tun_detach_all()
sk_data_ready() will wakeup waiters exactly like wake_up_all()
We do not use wake_up_all() in net/ipv4 & net/ipv6, have you seen any
bug because of this ?
wake_up_all() is a lazy call, when an author cannot be careful enough to
use a better way.
Your resistance shows that you think the _existing_ code might be racy.
Care to elaborate instead ?
> - Not sure it was a problem but sock_def_readable() will not wake up
> uninterruptible task during tun destroying.
Thats irrelevant. We are supposed to unblock threads that are waiting on
the tun device, not threads doing uninterruptible stuff somewhere else
in the kernel.
Eventually they will later reach tun device and will detect device is
gone/dismantled.
> - If we make sock_fasync() works for tun in the future, it may send
> SIGIO to user process during tun destroying which is not expected.
SOCK_FASYNC is not set on the tun socket.
sk_wake_async() does nothing in this case. As for 99.9999 % of TCP
sockets and nobody ever noticed this code path was almost dead.
--
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