Re: [patch 1/3] Percpu infrastructure to rebase the per cpu area to 0UL

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

 



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