There's no need to add self to waitqueue if doing a nonblock read. This could
help to avoid the spinlock contention.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
        ssize_t ret = 0;
 
        while (len) {
-               prepare_to_wait(sk_sleep(&q->sk), &wait, TASK_INTERRUPTIBLE);
+               if (!noblock)
+                       prepare_to_wait(sk_sleep(&q->sk), &wait,
+                                       TASK_INTERRUPTIBLE);
 
                /* Read frames from the queue */
                skb = skb_dequeue(&q->sk.sk_receive_queue);
                break;
        }
 
-       finish_wait(sk_sleep(&q->sk), &wait);
+       if (!noblock)
+               finish_wait(sk_sleep(&q->sk), &wait);
        return ret;
 }