Update sysprof to 1.0.7

Andres Salomon dilinger at debian.unroutableorg
Tue Jan 2 10:59:12 EST 2007


Commit:     54ca23442113e12fb253a21e4cb47d0136da0c00
Parent:     00ed15fce7096ba25a343519ad7b74620b04db92
commit 54ca23442113e12fb253a21e4cb47d0136da0c00
Author:     Andres Salomon <dilinger at debian.org>
AuthorDate: Wed Nov 29 11:19:37 2006 -0500
Commit:     Andres Salomon <dilinger at debian.org>
CommitDate: Wed Nov 29 11:19:37 2006 -0500

    Update sysprof to 1.0.7
---
 drivers/sysprof/config.h         |    4 ++-
 drivers/sysprof/sysprof-module.c |   46 ++++++++++++++++++++++++++------------
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/drivers/sysprof/config.h b/drivers/sysprof/config.h
index 89a3aef..14a5173 100644
--- a/drivers/sysprof/config.h
+++ b/drivers/sysprof/config.h
@@ -14,10 +14,10 @@ #define PACKAGE_BUGREPORT ""
 #define PACKAGE_NAME "sysprof"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "sysprof 1.0.3"
+#define PACKAGE_STRING "sysprof 1.0.7"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "sysprof"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.0.3"
+#define PACKAGE_VERSION "1.0.7"
diff --git a/drivers/sysprof/sysprof-module.c b/drivers/sysprof/sysprof-module.c
index 441f396..698a8c0 100644
--- a/drivers/sysprof/sysprof-module.c
+++ b/drivers/sysprof/sysprof-module.c
@@ -19,18 +19,14 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#ifdef CONFIG_SMP
+# define __SMP__
+#endif
 #include <asm/atomic.h>
 #include <linux/kernel.h>  /* Needed for KERN_ALERT */
 #include <linux/module.h>  /* Needed by all modules */
 #include <linux/sched.h>
 
-#if !CONFIG_PROFILING
-# error Sysprof needs a kernel with profiling support compiled in.
-#endif
-#ifdef CONFIG_SMP
-# define __SMP__
-#endif
-
 #include <linux/proc_fs.h>
 #include <asm/uaccess.h>
 #include <linux/poll.h>
@@ -40,10 +36,19 @@ #include <linux/profile.h>
 
 #include "sysprof-module.h"
 
-#include "config.h"
+#include "../config.h"
 
 #include <linux/version.h>
-#if KERNEL_VERSION(2,6,11) > LINUX_VERSION_CODE
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+#include <linux/config.h>
+#endif
+
+#if !CONFIG_PROFILING
+# error Sysprof needs a kernel with profiling support compiled in.
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
 # error Sysprof needs a Linux 2.6.11 kernel or later
 #endif
 #include <linux/kallsyms.h>
@@ -111,24 +116,31 @@ #endif
 	return 0;
 }
 
+DEFINE_PER_CPU(int, n_samples);
+
 static int
 timer_notify (struct pt_regs *regs)
 {
-	static int n_samples;
-	struct SysprofStackTrace *trace = head;
+	SysprofStackTrace *trace = head;
 	int i;
 	int is_user;
+	static atomic_t in_timer_notify = ATOMIC_INIT(1);
 
-	if ((n_samples++ % INTERVAL) != 0)
+	if ((++get_cpu_var(n_samples) % INTERVAL) != 0)
 		return 0;
 
+	/* 0: locked, 1: unlocked */
+	
+	if (!atomic_dec_and_test(&in_timer_notify))
+		goto out;
+	
 	is_user = user_mode(regs);
 
 	if (!current || current->pid == 0)
-		return 0;
+		goto out;
 	
 	if (is_user && current->state != TASK_RUNNING)
-		return 0;
+		goto out;
 
 	if (!is_user)
 	{
@@ -176,7 +188,9 @@ timer_notify (struct pt_regs *regs)
 		head = &stack_traces[0];
 	
 	wake_up (&wait_for_trace);
-	
+
+out:
+	atomic_inc(&in_timer_notify);
 	return 0;
 }
 
@@ -192,6 +206,8 @@ procfile_read(char *buffer, 
 		return -EWOULDBLOCK;
 	
 	*buffer_location = (char *)tail;
+
+	BUG_ON(tail->pid == 0);
 	
 	if (tail++ == &stack_traces[N_TRACES - 1])
 		tail = &stack_traces[0];


More information about the Commits-kernel mailing list