“4f42071c943977e91e7fda8230e4f85bc3ba117a”上不存在“git@gitcode.net:openeuler/raspberrypi-kernel.git”
提交 89cee917 编写于 作者: J Jason Wang 提交者: David S. Miller

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: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NJason Wang <jasowang@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ed0483fa
无相关合并请求
...@@ -845,7 +845,9 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, ...@@ -845,7 +845,9 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
ssize_t ret = 0; ssize_t ret = 0;
while (len) { 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 */ /* Read frames from the queue */
skb = skb_dequeue(&q->sk.sk_receive_queue); skb = skb_dequeue(&q->sk.sk_receive_queue);
...@@ -867,7 +869,8 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, ...@@ -867,7 +869,8 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
break; break;
} }
finish_wait(sk_sleep(&q->sk), &wait); if (!noblock)
finish_wait(sk_sleep(&q->sk), &wait);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部