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

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


This one's for x86_64

diff -ruN -X dontdiff linux-2.5.55/arch/x86_64/kernel/apic.c prof_counter-2.5.55/arch/x86_64/kernel/apic.c
--- linux-2.5.55/arch/x86_64/kernel/apic.c Thu Jan 9 09:33:55 2003
+++ prof_counter-2.5.55/arch/x86_64/kernel/apic.c Mon Jan 13 14:27:46 2003
@@ -39,7 +39,7 @@

int prof_multiplier[NR_CPUS] = { 1, };
int prof_old_multiplier[NR_CPUS] = { 1, };
-int prof_counter[NR_CPUS] = { 1, };
+DEFINE_PER_CPU(int, prof_counter) = 1;

int get_maxlvt(void)
{
@@ -901,7 +901,7 @@

x86_do_profile(regs);

- if (--prof_counter[cpu] <= 0) {
+ if (--per_cpu(prof_counter, cpu) <= 0) {
/*
* The multiplier may have changed since the last time we got
* to this point as a result of the user writing to
@@ -910,10 +910,11 @@
*
* Interrupts are already masked off at this point.
*/
- prof_counter[cpu] = prof_multiplier[cpu];
- if (prof_counter[cpu] != prof_old_multiplier[cpu]) {
- __setup_APIC_LVTT(calibration_result/prof_counter[cpu]);
- prof_old_multiplier[cpu] = prof_counter[cpu];
+ per_cpu(prof_counter, cpu) = prof_multiplier[cpu];
+ if (per_cpu(prof_counter, cpu) != prof_old_multiplier[cpu]) {
+ __setup_APIC_LVTT(calibration_result/
+ per_cpu(prof_counter, cpu));
+ prof_old_multiplier[cpu] = per_cpu(prof_counter, cpu);
}

#ifdef CONFIG_SMP
diff -ruN -X dontdiff linux-2.5.55/arch/x86_64/kernel/smpboot.c prof_counter-2.5.55/arch/x86_64/kernel/smpboot.c
--- linux-2.5.55/arch/x86_64/kernel/smpboot.c Thu Jan 9 09:34:28 2003
+++ prof_counter-2.5.55/arch/x86_64/kernel/smpboot.c Mon Jan 13 14:30:00 2003
@@ -774,7 +774,7 @@

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

static void __init smp_boot_cpus(unsigned int max_cpus)
{
@@ -787,7 +787,7 @@

for (apicid = 0; apicid < NR_CPUS; apicid++) {
x86_apicid_to_cpu[apicid] = -1;
- prof_counter[apicid] = 1;
+ per_cpu(prof_counter, apicid) = 1;
prof_old_multiplier[apicid] = 1;
prof_multiplier[apicid] = 1;
}
-
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/