Re: Light weight counter 1/1 Framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christoph Lameter <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux