[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1338894329.2760.2318.camel@edumazet-glaptop>
Date: Tue, 05 Jun 2012 13:05:29 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Hong zhi guo <honkiko@...il.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, arnd@...db.de,
zhiguo.hong@....com, vikifang@...iper.net
Subject: Re: [PATCH] macvtap: use set_curren_state to ensure mb
On Tue, 2012-06-05 at 18:46 +0800, Hong zhi guo wrote:
> replace raw assignment of current->state with
> set_current_state(TASK_...) to ensure memory barrier.
>
> Signed-off-by: Hong Zhiguo <honkiko@...il.com>
> ---
> drivers/net/macvtap.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 2ee56de..62754f6 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -853,7 +853,7 @@ static ssize_t macvtap_do_read(struct
> macvtap_queue *q, struct kiocb *iocb,
>
> add_wait_queue(sk_sleep(&q->sk), &wait);
> while (len) {
> - current->state = TASK_INTERRUPTIBLE;
> + set_current_state(TASK_INTERRUPTIBLE);
>
> /* Read frames from the queue */
> skb = skb_dequeue(&q->sk.sk_receive_queue);
> @@ -875,7 +875,7 @@ static ssize_t macvtap_do_read(struct
> macvtap_queue *q, struct kiocb *iocb,
> break;
> }
>
> - current->state = TASK_RUNNING;
> + set_current_state(TASK_RUNNING);
> remove_wait_queue(sk_sleep(&q->sk), &wait);
> return ret;
> }
Why not using the more standard :
prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
and
finish_wait(sk_sleep(sk), &wait);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists