summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
74e9f5f)
some atomic operations are only atomic, not ordered. Thus a CPU is allowed
to reorder memory references to an object to before the reference is
obtained. This fixes it.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
void kref_init(struct kref *kref)
{
atomic_set(&kref->refcount,1);
void kref_init(struct kref *kref)
{
atomic_set(&kref->refcount,1);
{
WARN_ON(!atomic_read(&kref->refcount));
atomic_inc(&kref->refcount);
{
WARN_ON(!atomic_read(&kref->refcount));
atomic_inc(&kref->refcount);
+ smp_mb__after_atomic_inc();