LWN.net Logo

Completely out of line spinlocks / oprofile

From:  Zwane Mwaikambo <zwane@linuxpower.ca>
To:  Linux Kernel <linux-kernel@vger.kernel.org>
Subject:  [PATCH][4/4] Completely out of line spinlocks / oprofile
Date:  Sat, 21 Aug 2004 14:28:49 -0400 (EDT)
Cc:  Andrew Morton <akpm@osdl.org>, John Levon <levon@movementarian.org>, Philippe Elie <phil.el@wanadoo.fr>, Keith Owens <kaos@sgi.com>

Making the spinlock text out of line results in inaccurate samples during
lock contention. Use profile_pc to provide a smarter way of figuring out
where we are.

 arch/i386/oprofile/op_model_athlon.c |    2 +-
 arch/i386/oprofile/op_model_p4.c     |    2 +-
 arch/i386/oprofile/op_model_ppro.c   |    2 +-
 drivers/oprofile/timer_int.c         |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

Signed-off-by: Zwane Mwaikambo <zwane@fsmlabs.com>

Index: linux-2.6.8.1-mm3/drivers/oprofile/timer_int.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.8.1-mm3/drivers/oprofile/timer_int.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 timer_int.c
--- linux-2.6.8.1-mm3/drivers/oprofile/timer_int.c	21 Aug 2004 13:14:56 -0000	1.1.1.1
+++ linux-2.6.8.1-mm3/drivers/oprofile/timer_int.c	21 Aug 2004 17:07:52 -0000
@@ -19,7 +19,7 @@ static int timer_notify(struct notifier_
 {
 	struct pt_regs * regs = (struct pt_regs *)data;
 	int cpu = smp_processor_id();
-	unsigned long eip = instruction_pointer(regs);
+	unsigned long eip = profile_pc(regs);

 	oprofile_add_sample(eip, !user_mode(regs), 0, cpu);
 	return 0;
Index: linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_athlon.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_athlon.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 op_model_athlon.c
--- linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_athlon.c	21 Aug 2004 13:14:49 -0000	1.1.1.1
+++ linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_athlon.c	21 Aug 2004 17:06:27 -0000
@@ -96,7 +96,7 @@ static int athlon_check_ctrs(unsigned in
 {
 	unsigned int low, high;
 	int i;
-	unsigned long eip = instruction_pointer(regs);
+	unsigned long eip = profile_pc(regs);
 	int is_kernel = !user_mode(regs);

 	for (i = 0 ; i < NUM_COUNTERS; ++i) {
Index: linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_p4.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_p4.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 op_model_p4.c
--- linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_p4.c	21 Aug 2004 13:14:49 -0000	1.1.1.1
+++ linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_p4.c	21 Aug 2004 17:06:43 -0000
@@ -595,7 +595,7 @@ static int p4_check_ctrs(unsigned int co
 {
 	unsigned long ctr, low, high, stag, real;
 	int i;
-	unsigned long eip = instruction_pointer(regs);
+	unsigned long eip = profile_pc(regs);
 	int is_kernel = !user_mode(regs);

 	stag = get_stagger();
Index: linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_ppro.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_ppro.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 op_model_ppro.c
--- linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_ppro.c	21 Aug 2004 13:14:49 -0000	1.1.1.1
+++ linux-2.6.8.1-mm3/arch/i386/oprofile/op_model_ppro.c	21 Aug 2004 17:07:03 -0000
@@ -91,7 +91,7 @@ static int ppro_check_ctrs(unsigned int
 {
 	unsigned int low, high;
 	int i;
-	unsigned long eip = instruction_pointer(regs);
+	unsigned long eip = profile_pc(regs);
 	int is_kernel = !user_mode(regs);

 	for (i = 0 ; i < NUM_COUNTERS; ++i) {
-
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/

Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds