tun: don't look at current when non-blocking
Subsystems (3)
PATCH 1/1 tun: don't look at current when non-blocking
We play with a wait queue even if socket is non blocking. This is an obvious waste. Besides, it will prevent calling the non blocking variant when current is not valid.
--- drivers/net/tun.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/tun.c +5 -3
@@ -1293,7 +1293,8 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,if (unlikely (!noblock))add_wait_queue (&tfile->wq.wait, &wait);while (len) { - current->state =TASK_INTERRUPTIBLE ; +if (unlikely (!noblock)) + current->state =TASK_INTERRUPTIBLE ;/* Read frames from the queue */ if (!(skb =skb_dequeue (&tfile->socket.sk->sk_receive_queue))) {
@@ -1320,9 +1321,10 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,break ; } - current->state =TASK_RUNNING ; -if (unlikely (!noblock)) +if (unlikely (!noblock)) { + current->state =TASK_RUNNING ;remove_wait_queue (&tfile->wq.wait, &wait); + }return ret; }
Signature · 1 line
MST
Quoted 7 lines · Michael S. Tsirkin
We play with a wait queue even if socket is non blocking. This is an obvious waste. Besides, it will prevent calling the non blocking variant when current is not valid.
Signed-off-by Michael S. Tsirkin <[email protected]>---
Quoted 30 lines
drivers/net/tun.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/net/tun.c +5
-3@@ -1293,7 +1293,8 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,if (unlikely (!noblock))add_wait_queue (&tfile->wq.wait, &wait);while (len) { - current->state =TASK_INTERRUPTIBLE ; +if (unlikely (!noblock)) + current->state =TASK_INTERRUPTIBLE ;/* Read frames from the queue */ if (!(skb =skb_dequeue (&tfile->socket.sk->sk_receive_queue))) {@@ -1320,9 +1321,10 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,break ; } - current->state =TASK_RUNNING ; -if (unlikely (!noblock)) +if (unlikely (!noblock)) { + current->state =TASK_RUNNING ;remove_wait_queue (&tfile->wq.wait, &wait); + }return ret; }
David Miller
maintainerFrom: "Michael S. Tsirkin" <[email protected]>
Date: Sun, 6 Oct 2013 21:25:12 +0300
Quoted 6 lines
We play with a wait queue even if socket is non blocking. This is an obvious waste. Besides, it will prevent calling the non blocking variant when current is not valid.
Signed-off-by Michael S. Tsirkin <[email protected]>
Applied and queued up for -stable, thanks.
Quoted 11 lines · David Miller
From: "Michael S. Tsirkin" <[email protected]>
Date: Sun, 6 Oct 2013 21:25:12 +0300Quoted 6 lines
We play with a wait queue even if socket is non blocking. This is an obvious waste. Besides, it will prevent calling the non blocking variant when current is not valid.
Signed-off-by Michael S. Tsirkin <[email protected]>Applied and queued up for -stable, thanks.
--
Michael, I believe this is just an optimization or a required patch of your following patches. So no need go for stable?
Quoted 9 lines · Jason Wang
Quoted 8 lines · David Miller
From: "Michael S. Tsirkin" <[email protected]>
Date: Sun, 6 Oct 2013 21:25:12 +0300Quoted 5 lines
We play with a wait queue even if socket is non blocking. This is an obvious waste. Besides, it will prevent calling the non blocking variant when current is not valid.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Michael S. Tsirkin <[email protected]>Applied and queued up for -stable, thanks.
--Michael, I believe this is just an optimization or a required patch of your following patches. So no need go for stable?
I don't think it's required for stable.
David Miller
maintainerFrom: "Michael S. Tsirkin" <[email protected]>
Date: Wed, 9 Oct 2013 11:13:54 +0300
Quoted 10 lines · Jason Wang
Quoted 9 lines · David Miller
Quoted 8 lines
From: "Michael S. Tsirkin" <[email protected]>
Date: Sun, 6 Oct 2013 21:25:12 +0300Quoted 5 lines
We play with a wait queue even if socket is non blocking. This is an obvious waste. Besides, it will prevent calling the non blocking variant when current is not valid.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Michael S. Tsirkin <[email protected]>Applied and queued up for -stable, thanks.
--Michael, I believe this is just an optimization or a required patch of your following patches. So no need go for stable?
I don't think it's required for stable.
Ok, removed from the -stable queue. Thanks.