Re: [patch] Make prof_counter use per-cpu areas patch 4/4 -- sparc arch

Ravikiran G Thirumalai (kiran@in.ibm.com)
Mon, 13 Jan 2003 18:08:25 +0530


This one's for sparc

diff -ruN -X dontdiff linux-2.5.55/arch/sparc/kernel/smp.c prof_counter-2.5.55/arch/sparc/kernel/smp.c
--- linux-2.5.55/arch/sparc/kernel/smp.c Thu Jan 9 09:33:58 2003
+++ prof_counter-2.5.55/arch/sparc/kernel/smp.c Mon Jan 13 14:35:15 2003
@@ -256,7 +256,7 @@
}

unsigned int prof_multiplier[NR_CPUS];
-unsigned int prof_counter[NR_CPUS];
+DEFINE_PER_CPU(unsigned int, prof_counter);
extern unsigned int lvl14_resolution;

int setup_profiling_timer(unsigned int multiplier)
diff -ruN -X dontdiff linux-2.5.55/arch/sparc/kernel/sun4d_smp.c prof_counter-2.5.55/arch/sparc/kernel/sun4d_smp.c
--- linux-2.5.55/arch/sparc/kernel/sun4d_smp.c Thu Jan 9 09:33:55 2003
+++ prof_counter-2.5.55/arch/sparc/kernel/sun4d_smp.c Mon Jan 13 14:37:21 2003
@@ -431,7 +431,7 @@
}

extern unsigned int prof_multiplier[NR_CPUS];
-extern unsigned int prof_counter[NR_CPUS];
+DECLARE_PER_CPU(unsigned int, prof_counter);

extern void sparc_do_profile(unsigned long pc, unsigned long o7);

@@ -455,14 +455,14 @@
if(!user_mode(regs))
sparc_do_profile(regs->pc, regs->u_regs[UREG_RETPC]);

- if(!--prof_counter[cpu]) {
+ if(!--per_cpu(prof_counter, cpu)) {
int user = user_mode(regs);

irq_enter();
update_process_times(user);
irq_exit();

- prof_counter[cpu] = prof_multiplier[cpu];
+ per_cpu(prof_counter, cpu) = prof_multiplier[cpu];
}
}

@@ -472,7 +472,7 @@
{
int cpu = hard_smp4d_processor_id();

- prof_counter[cpu] = prof_multiplier[cpu] = 1;
+ per_cpu(prof_counter, cpu) = prof_multiplier[cpu] = 1;
load_profile_irq(cpu, lvl14_resolution);
}

-
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/