Re: PATCH] cpuidle: A new variant of the menu governor to boost IOperformance

From: Tejun Heo
Date: Mon Sep 14 2009 - 04:04:56 EST


Andrew Morton wrote:
> This fails to compile in linux-next:
>
> drivers/cpuidle/governors/menu-tng.o:(.discard+0x0): multiple definition of `__pcpu_unique_menu_devices'
> drivers/cpuidle/governors/menu.o:(.discard+0x0): first defined here
>
> because we have
>
> static DEFINE_PER_CPU(struct menu_device, menu_devices);
>
> in both menu.c and menu-tng.c.
>
> Despite the `static', the percpu changes in
>
> commit 7c756e6e19e71f0327760d8955f7077118ebb2b1
> Author: Tejun Heo <tj@xxxxxxxxxx>
> AuthorDate: Wed Jun 24 15:13:50 2009 +0900
> Commit: Tejun Heo <tj@xxxxxxxxxx>
> CommitDate: Wed Jun 24 15:13:50 2009 +0900
>
> percpu: implement optional weak percpu definitions
>
> are emitting global symbol derived from `menu_devices' and they clash.
>
> I'll rename menu_devices to fix that up, but we have a problem...

Unfortunately, this was the only way we could come up with to get
alpha and s390 working with the new percpu allocator. On other archs,
the global definition isn't necessary but config option
DEBUG_FORCE_WEAK_PER_CPU enables it so that alpha and s390 don't choke
on generic code later.

The core of the problem is that the memory model used by gcc on those
two archs assume that static symbols are reachable with small offset
but percpu variables, static or not, always end up way away. Making
all percpu variables weak and using global symbols to enforce global
uniqueness works around the problem but with the side effect you're
seeing.

If someone has any better ideas, I would happy to remove the annoying
restriction.

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/