[PATCH 3/8] OProfile update

John Levon (levon@movementarian.org)
Sun, 4 May 2003 00:44:06 +0100


Clear up the code around start_sem so it's more obvious, and remove a pointless
down/up pair on buffer_sem (shutdown is already synchronised in sync_stop()).

diff -Naur -X dontdiff linux-cvs/drivers/oprofile/oprof.c linux-me/drivers/oprofile/oprof.c
--- linux/drivers/oprofile/oprof.c 2003-04-30 19:58:07.000000000 +0100
+++ linux-me/drivers/oprofile/oprof.c 2003-04-29 01:16:00.000000000 +0100
@@ -28,6 +28,8 @@
{
int err;

+ down(&start_sem);
+
if ((err = alloc_cpu_buffers()))
goto out;

@@ -45,7 +47,6 @@
if ((err = sync_start()))
goto out3;

- down(&start_sem);
is_setup = 1;
up(&start_sem);
return 0;
@@ -58,6 +59,7 @@
out1:
free_cpu_buffers();
out:
+ up(&start_sem);
return err;
}

@@ -106,22 +108,20 @@

void oprofile_shutdown(void)
{
+ down(&start_sem);
sync_stop();
if (oprofile_ops->shutdown)
oprofile_ops->shutdown();
- /* down() is also necessary to synchronise all pending events
- * before freeing */
- down(&buffer_sem);
is_setup = 0;
- up(&buffer_sem);
free_event_buffer();
free_cpu_buffers();
+ up(&start_sem);
}

-
+
extern void timer_init(struct oprofile_operations ** ops);

-
+
static int __init oprofile_init(void)
{
int err;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/