lkml.org 
[lkml]   [2007]   [Dec]   [3]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromRusty Russell <>
SubjectRe: [patch 1/3] Percpu infrastructure to rebase the per cpu area to 0UL
DateSun, 2 Dec 2007 14:04:56 +1100
On Friday 30 November 2007 17:43:06 Christoph Lameter wrote:
> Support an option
>
> 	CONFIG_PERCPU_ZERO_BASED
>
> that makes offsets for per cpu variables start at zero.
>
> If a percpu area starts at zero then
>
> 1. We do not need RELOC_HIDE anymore

Hi Christoph,

    Why do you think this is true?  You're still doing arithmetic on variable 
addresses beyond the bound of the variable.

> 2. Indexes off the per cpu area for each processor are small
>
> 3. The percpu area "addresses" are offsets and we can then
>    have allocpercpu/cpu_alloc in the future also use these
>    offsets so that percpu functions can take any type of
>    percpu address if it is provided by a percpu variable
>    or a pointer obtained via allocpercpu/cpu_alloc.

This last point is orthogonal to offsetting at zero though...

> +#ifdef CONFIG_PERCPU_ZERO_BASED
> +extern char __per_cpu_load[];
> +extern char ____per_cpu_size[];
> +#define __per_cpu_size ((unsigned long)&____per_cpu_size)
> +#define __per_cpu_start ((char *)0)
> +#define __per_cpu_end ((char *)__per_cpu_size)
> +#else
>  extern char __per_cpu_start[], __per_cpu_end[];
> +#define __per_cpu_load __per_cpu_start
> +#define __per_cpu_size (__per_cpu_end - __per_cpu_start)
> +#endif

Hmm, can't you just define __per_cpu_start and __per_cpu_end in the linker 
script and fold this code back together again?

>  	for_each_possible_cpu(i) {
> -		start = (unsigned long) &__per_cpu_start + per_cpu_offset(i);
> -		end   = (unsigned long) &__per_cpu_start + PERCPU_ENOUGH_ROOM
> +		start = (unsigned long) __per_cpu_start + per_cpu_offset(i);
> +		end   = (unsigned long) __per_cpu_start + PERCPU_ENOUGH_ROOM
>  					+ per_cpu_offset(i);

I found the original clearer; why change it?

Cheers,
Rusty.


\
 
 \ /
  Last update: 2007-12-03 10:53    [from the cache]
©2003-2008