diff options
author | Nick Piggin <npiggin@suse.de> | 2008-10-23 16:25:54 +0200 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2008-10-27 19:15:41 +0100 |
commit | cae042a73bb22fc4132b04ff94bd684456203089 (patch) | |
tree | 5f4042eaab705c64461522a09967ae7581bdb0d0 | |
parent | fa448d6008cc81a3537e5db168fa0490e0caba68 (diff) |
oprofile: fix memory ordering
Regular bitops don't work as locks on all architectures.
Also: can use non-atomic unlock as no concurrent stores to the word.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Robert Richter <robert.richter@amd.com>
-rw-r--r-- | drivers/oprofile/event_buffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index d962ba0dd87..191a3202cec 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c @@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (test_and_set_bit(0, &buffer_opened)) + if (test_and_set_bit_lock(0, &buffer_opened)) return -EBUSY; /* Register as a user of dcookies @@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) fail: dcookie_unregister(file->private_data); out: - clear_bit(0, &buffer_opened); + __clear_bit_unlock(0, &buffer_opened); return err; } @@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file) dcookie_unregister(file->private_data); buffer_pos = 0; atomic_set(&buffer_ready, 0); - clear_bit(0, &buffer_opened); + __clear_bit_unlock(0, &buffer_opened); return 0; } |