Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89cee917 authored by Jason Wang's avatar Jason Wang Committed by David S. Miller
Browse files

macvtap: do not add self to waitqueue if doing a nonblock read



There's no need to add self to waitqueue if doing a nonblock read. This could
help to avoid the spinlock contention.

Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ed0483fa
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -845,7 +845,9 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
	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);
@@ -867,6 +869,7 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
		break;
	}

	if (!noblock)
		finish_wait(sk_sleep(&q->sk), &wait);
	return ret;
}