Re: [GIT RFC] percpu: use dynamic percpu allocator as the defaultpercpu allocator

From: Tejun Heo
Date: Wed Apr 01 2009 - 04:20:18 EST


Martin Schwidefsky wrote:
> On Wed, 01 Apr 2009 09:07:41 +0900
> Tejun Heo <tj@xxxxxxxxxx> wrote:
>
>> Martin Schwidefsky wrote:
>>> I got the dynamic cpu allocator to work with the patch below. Anybody
>>> with an objection against the SHIFT_PERCPU_VAR macro ?
>> One of the main goals of the percpu allocator is removing the
>> distinction between statically and dynamically allocated percpu
>> variables, so that it can be treated like other normal variables. For
>> all archs other than s390, alpha and ia64, achieving this is easy, so
>> I wish we could come up with solution for the three archs too. Is it
>> possible to do similar stuff with pointer values with input
>> constraint which can take both constant and variable?
>
> Is the goal to use the same access macros for both dynamically and
> statically allocated percpu variables? That would make the proposed
> solution impractical.

Yeah, it's one of the goals so that we don't have to have two sets of
APIs (e.g. the fast percpu_*() accessors).

> The "X" constraint trick we used so far tells the compiler to pass the
> argument verbatim to the assembler. The assembler knows how to deal
> with symbol@GOTENT. If we pass a gcc variable or even a more general
> term via an "X" constraint the assembler gets <something C-ish>@GOTENT.
> It is not possible to parse this in the assembler. To do what you want
> to achieve would mean to avoid using the "X" constraint. Which means
> that we cannot use the GOTENT trick anymore. If we let the compiler
> resolve the address for a static per cpu variable we end up with the
> larl problem. Ouch!
>
> So far the SHIFT_PERCPU_PTR/SHIFT_PERCPU_VAR is the only solution
> I have found for s390 and the dynamic percpu allocator. I'll keep
> looking for a better solution but I am not optimistic.

What does the assembler do when it gets GOTENT? GOTENT sounds like
global offset table entry, so does it make the assembler emit an entry
in GOT and then get the address indirectly?

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/