[PATCH] memory ordering in __kfifo primitives
authorPaul E. McKenney <paulmck@us.ibm.com>
Fri, 29 Sep 2006 09:00:11 +0000 (02:00 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 16:18:13 +0000 (09:18 -0700)
commita45bce49545739a940f8bd4ca85c3b7435564893
tree3f558e487448db9e49c8d4cd36379d9f42f93da2
parent99de055ac065e19ed69de961e97c6336a261b34e
[PATCH] memory ordering in __kfifo primitives

Both __kfifo_put() and __kfifo_get() have header comments stating that if
there is but one concurrent reader and one concurrent writer, locking is not
necessary.  This is almost the case, but a couple of memory barriers are
needed.  Another option would be to change the header comments to remove the
bit about locking not being needed, and to change the those callers who
currently don't use locking to add the required locking.  The attachment
analyzes this approach, but the patch below seems simpler.

Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
Cc: Stelian Pop <stelian@popies.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/kfifo.c