lkml.org 
[lkml]   [2011]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFD 1/9] Change cpustat fields to an array.
From
Date
On Fri, 2011-09-23 at 19:20 -0300, Glauber Costa wrote:
> /* Must have preemption disabled for this to be meaningful. */
> -#define kstat_this_cpu __get_cpu_var(kstat)
> +#define kstat_this_cpu this_cpu_ptr(task_group_kstat(current))

This just lost you a debug check, the former would whinge when called
without preemption, the new one wont. Its part of the this_cpu feature
set to make debugging impossible.

> +#else
> +#define kstat_cpu(cpu) per_cpu(kstat, cpu)
> +#define kstat_this_cpu (&__get_cpu_var(kstat))
> +#endif
>
> extern unsigned long long nr_context_switches(void);
>
> @@ -52,8 +62,8 @@ struct irq_desc;
> static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
> struct irq_desc *desc)
> {
> - __this_cpu_inc(kstat.irqs[irq]);
> - __this_cpu_inc(kstat.irqs_sum);
> + kstat_this_cpu->irqs[irq]++;
> + kstat_this_cpu->irqs_sum++;

It might be worth looking at the asm output of that, I think you made it
worse, but I'm not quite sure how smart gcc is, it might just figure out
what you meant.

> }


\
 
 \ /
  Last update: 2011-09-27 23:03    [from the cache]
©2003-2011 Jasper Spaans