Module: xenomai-forge Branch: next Commit: bc0b0d17042a118e1bb394f7969a9ba3c47017cb URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=bc0b0d17042a118e1bb394f7969a9ba3c47017cb
Author: Philippe Gerum <r...@xenomai.org> Date: Tue Jul 30 17:32:43 2013 +0200 cobalt/lock: turn lock statistics into per-cpu data --- include/cobalt/kernel/lock.h | 3 ++- kernel/cobalt/debug.c | 2 +- kernel/cobalt/lock.c | 4 ++-- kernel/cobalt/procfs.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/cobalt/kernel/lock.h b/include/cobalt/kernel/lock.h index d26013b..a019100 100644 --- a/include/cobalt/kernel/lock.h +++ b/include/cobalt/kernel/lock.h @@ -25,6 +25,7 @@ #define _COBALT_KERNEL_LOCK_H #include <linux/ipipe.h> +#include <linux/percpu.h> #include <cobalt/kernel/assert.h> /** \addtogroup lock @@ -95,7 +96,7 @@ int xnlock_dbg_release(struct xnlock *lock, const char *file, int line, const char *function); -extern struct xnlockinfo xnlock_stats[]; +DECLARE_PER_CPU(struct xnlockinfo, xnlock_stats); #else /* !XENO_DEBUG(XNLOCK) */ diff --git a/kernel/cobalt/debug.c b/kernel/cobalt/debug.c index b2540e3..c2afc2f 100644 --- a/kernel/cobalt/debug.c +++ b/kernel/cobalt/debug.c @@ -583,7 +583,7 @@ int xnlock_dbg_release(struct xnlock *lock, lock_time = xnclock_read_raw(&nkclock) - lock->lock_date; cpu = ipipe_processor_id(); - stats = &xnlock_stats[cpu]; + stats = &per_cpu(xnlock_stats, cpu); if (lock->file == NULL) { lock->file = "??"; diff --git a/kernel/cobalt/lock.c b/kernel/cobalt/lock.c index 7e43cd3..bc9077e 100644 --- a/kernel/cobalt/lock.c +++ b/kernel/cobalt/lock.c @@ -55,8 +55,8 @@ EXPORT_SYMBOL_GPL(__xnlock_spin); #endif /* CONFIG_SMP || XENO_DEBUG(XNLOCK) */ #if XENO_DEBUG(XNLOCK) -struct xnlockinfo xnlock_stats[NR_CPUS]; -EXPORT_SYMBOL_GPL(xnlock_stats); +DEFINE_PER_CPU(struct xnlockinfo, xnlock_stats); +EXPORT_PER_CPU_SYMBOL(xnlock_stats); #endif /*@}*/ diff --git a/kernel/cobalt/procfs.c b/kernel/cobalt/procfs.c index 9600ccc..dd1c32b 100644 --- a/kernel/cobalt/procfs.c +++ b/kernel/cobalt/procfs.c @@ -39,7 +39,7 @@ static int lock_vfile_show(struct xnvfile_regular_iterator *it, void *data) for_each_online_cpu(cpu) { xnlock_get_irqsave(&nklock, s); - lockinfo = xnlock_stats[cpu]; + lockinfo = per_cpu(xnlock_stats, cpu); xnlock_put_irqrestore(&nklock, s); if (cpu > 0) @@ -76,7 +76,7 @@ static ssize_t lock_vfile_store(struct xnvfile_input *input) for_each_online_cpu(cpu) { xnlock_get_irqsave(&nklock, s); - memset(&xnlock_stats[cpu], '\0', sizeof(xnlock_stats[cpu])); + memset(&per_cpu(xnlock_stats, cpu), '\0', sizeof(struct xnlockinfo)); xnlock_put_irqrestore(&nklock, s); } _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git