lkml.org 
[lkml]   [2006]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Light weight counter 1/1 Framework
Christoph Lameter <clameter@sgi.com> wrote:
>
> -/*
> - * Accumulate the page_state information across all CPUs.
> - * The result is unavoidably approximate - it can change
> - * during and after execution of this function.
> - */

sob. How about updating the nice comment rather than removing it?

>
> -void get_full_page_state(struct page_state *ret)
> +void all_vm_events(unsigned long *ret)
> {
> - cpumask_t mask = CPU_MASK_ALL;
> -
> - __get_page_state(ret, sizeof(*ret) / sizeof(unsigned long), &mask);
> + sum_vm_events(ret, &cpu_online_map);
> }
> +EXPORT_SYMBOL(all_vm_events);
>
> -unsigned long read_page_state_offset(unsigned long offset)
> +unsigned long get_global_vm_events(enum vm_event_item e)
> {
> unsigned long ret = 0;
> int cpu;
>
> - for_each_online_cpu(cpu) {
> - unsigned long in;
> + for_each_possible_cpu(cpu)
> + ret += per_cpu(vm_event_states, cpu).event[e];
>
> - in = (unsigned long)&per_cpu(page_states, cpu) + offset;
> - ret += *((unsigned long *)in);
> - }
> return ret;
> }

Here. Some description of the difference between these two, and why one
would call one and not the other.

I'd be rather interested in reading that comment because afaict,
get_global_vm_events() has no callers.

And nor should it, please. It has potential to be seriously inefficient.
Much, much better to kill this function and to implement a CPU hotplug
notifier to spill the going-away CPU's stats into another CPU's
accumulators.

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

\
 
 \ /
  Last update: 2006-06-09 23:33    [W:0.055 / U:1.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site