mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: paulmck@us.ibm.com
Cc: stelian@popies.net, linux-kernel@vger.kernel.org,
	paulus@au1.ibm.com, anton@au1.ibm.com,
	open-iscsi@googlegroups.com, pradeep@us.ibm.com,
	mashirle@us.ibm.com
Subject: Re: [PATCH] memory ordering in __kfifo primitives
Date: Wed, 9 Aug 2006 17:29:10 -0700	[thread overview]
Message-ID: <20060809172910.614ad979.akpm@osdl.org> (raw)
In-Reply-To: <20060810001823.GA3026@us.ibm.com>

On Wed, 9 Aug 2006 17:18:23 -0700
"Paul E. McKenney" <paulmck@us.ibm.com> wrote:

> @@ -129,6 +129,8 @@ unsigned int __kfifo_put(struct kfifo *f
>  	/* then put the rest (if any) at the beginning of the buffer */
>  	memcpy(fifo->buffer, buffer + l, len - l);
>  
> +	smp_wmb();
> +
>  	fifo->in += len;
>  
>  	return len;
> @@ -161,6 +163,8 @@ unsigned int __kfifo_get(struct kfifo *f
>  	/* then get the rest (if any) from the beginning of the buffer */
>  	memcpy(buffer + l, fifo->buffer, len - l);
>  
> +	smp_mb();
> +
>  	fifo->out += len;
>  
>  	return len;

When adding barriers, please also add a little comment explaining what the
barrier is protecting us from.

Often it's fairly obvious, but sometimes it is not, and in both cases it is still
useful to communicate the programmer's intent in this way.

Thanks.

  reply	other threads:[~2006-08-10  0:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10  0:18 Paul E. McKenney
2006-08-10  0:29 ` Andrew Morton [this message]
2006-08-10  1:01   ` Paul E. McKenney
2006-08-10  0:33 ` Paul E. McKenney
2006-08-10  5:48   ` Mike Christie
2006-08-10 13:41     ` Paul E. McKenney
2006-08-10 14:26       ` Stelian Pop
2006-08-10 15:39         ` Paul E. McKenney
2006-08-10 15:47           ` Stelian Pop
2006-08-10 16:11             ` Paul E. McKenney
2006-08-10 16:23               ` Stelian Pop
2006-08-10 16:47                 ` Paul E. McKenney
2006-08-10 20:27                   ` Stelian Pop
2006-08-10 20:54                     ` Paul E. McKenney

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=20060809172910.614ad979.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=anton@au1.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mashirle@us.ibm.com \
    --cc=open-iscsi@googlegroups.com \
    --cc=paulmck@us.ibm.com \
    --cc=paulus@au1.ibm.com \
    --cc=pradeep@us.ibm.com \
    --cc=stelian@popies.net \
    /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

Powered by JetHome