提交 cae042a7 编写于 作者: N Nick Piggin 提交者: Robert Richter

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: NNick Piggin <npiggin@suse.de>
Signed-off-by: NRobert Richter <robert.richter@amd.com>
上级 fa448d60
...@@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) ...@@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (test_and_set_bit(0, &buffer_opened)) if (test_and_set_bit_lock(0, &buffer_opened))
return -EBUSY; return -EBUSY;
/* Register as a user of dcookies /* Register as a user of dcookies
...@@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) ...@@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
fail: fail:
dcookie_unregister(file->private_data); dcookie_unregister(file->private_data);
out: out:
clear_bit(0, &buffer_opened); __clear_bit_unlock(0, &buffer_opened);
return err; return err;
} }
...@@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file) ...@@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file)
dcookie_unregister(file->private_data); dcookie_unregister(file->private_data);
buffer_pos = 0; buffer_pos = 0;
atomic_set(&buffer_ready, 0); atomic_set(&buffer_ready, 0);
clear_bit(0, &buffer_opened); __clear_bit_unlock(0, &buffer_opened);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册