Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hong zhi guo <honkiko@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, arnd@arndb.de,
	zhiguo.hong@nsn.com, vikifang@juniper.net
Subject: Re: [PATCH] macvtap: use set_curren_state to ensure mb
Date: Tue, 05 Jun 2012 13:05:29 +0200	[thread overview]
Message-ID: <1338894329.2760.2318.camel@edumazet-glaptop> (raw)
In-Reply-To: <CAA7+ByX7Kp+Zh3ZQ2D6rSuhu6WCeqL-1MgDi9gy-0hHizVXncg@mail.gmail.com>

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@gmail.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);

  parent reply	other threads:[~2012-06-05 11:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 10:46 [PATCH] macvtap: use set_curren_state to ensure mb Hong zhi guo
     [not found] ` <CAA7+ByVzL2kA=uN_yUVFpSnDbLgwecAi9f__QPzDoXHpt_vyaQ@mail.gmail.com>
2012-06-05 10:57   ` Hong zhi guo
2012-06-05 11:05 ` Eric Dumazet [this message]
2012-06-05 12:05   ` Hong zhi guo
2012-06-06 17:48     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338894329.2760.2318.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=honkiko@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vikifang@juniper.net \
    --cc=zhiguo.hong@nsn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox