Message ID | CAA7+ByUH8LsSrbetHngEZmaHkvK5aUO5v7-F=+wbveo6q68f-g@mail.gmail.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Hong zhi guo <honkiko@gmail.com> Date: Tue, 5 Jun 2012 20:05:34 +0800 > On Tue, Jun 5, 2012 at 7:05 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote: >> Why not using the more standard : >> >> prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); >> >> and >> >> finish_wait(sk_sleep(sk), &wait); >> > > Thanks for your comments. The difference is that prepare_to_wait > inside loop introduces extra "list_empty" judgement than original > patch. But personally I prefer the newer version too: > > Signed-off-by: Hong Zhiguo <honkiko@gmail.com> Please don't submit patches like this: 1) When submitting new versions of a patch, make a fresh new mailing list posting with just the patch and it's commit message. Do not post new versions by replying to other conversations. 2) Your email client has severely corrupted the patch, breaking up long lines etc. Please read Documentation/email-clients.txt to learn how to fix this. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 2ee56de..0737bd4 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -847,13 +847,12 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, const struct iovec *iv, unsigned long len, int noblock) { - DECLARE_WAITQUEUE(wait, current); + DEFINE_WAIT(wait); struct sk_buff *skb; ssize_t ret = 0; - add_wait_queue(sk_sleep(&q->sk), &wait); while (len) { - current->state = TASK_INTERRUPTIBLE; + prepare_to_wait(sk_sleep(&q->sk), &wait, TASK_INTERRUPTIBLE); /* Read frames from the queue */