* [patch] oprofile: fix memory ordering
@ 2008-10-23 14:25 Nick Piggin
2008-10-27 18:27 ` Robert Richter
0 siblings, 1 reply; 2+ messages in thread
From: Nick Piggin @ 2008-10-23 14:25 UTC (permalink / raw)
To: levon, Linux Kernel Mailing List
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>
---
Index: linux-2.6/drivers/oprofile/event_buffer.c
===================================================================
--- linux-2.6.orig/drivers/oprofile/event_buffer.c
+++ linux-2.6/drivers/oprofile/event_buffer.c
@@ -105,7 +105,7 @@ static int event_buffer_open(struct inod
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 inod
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 i
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] oprofile: fix memory ordering
2008-10-23 14:25 [patch] oprofile: fix memory ordering Nick Piggin
@ 2008-10-27 18:27 ` Robert Richter
0 siblings, 0 replies; 2+ messages in thread
From: Robert Richter @ 2008-10-27 18:27 UTC (permalink / raw)
To: Nick Piggin; +Cc: levon, Linux Kernel Mailing List, Ingo Molnar
On 23.10.08 16:25:54, Nick Piggin wrote:
> 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>
I applied your patch to oprofile/oprofile-for-tip. Thanks Nick.
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-27 18:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-23 14:25 [patch] oprofile: fix memory ordering Nick Piggin
2008-10-27 18:27 ` Robert Richter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.