Re: regarding the x86_64 zero-based percpu patches

Tejun Heo
2009-01-13T00:34:16Z

Hello, Eric.

Eric W. Biederman wrote:
>> There are 2M TLB entries on x86_64. If we really get into a high usage
>> scenario then the 2M entry makes sense. Average server memory sizes likely
>> already are way beyond 10G per box. The higher that goes the more
>> reasonable the 2M TLB entry will be.
>
> 2M of per cpu data doesn't make sense, and likely indicates a design
> flaw somewhere. It just doesn't make sense to have large amounts of
> data allocated per cpu.

Why? On almost all large machines I've seen or heard of, memory size
scales way better than the number of cpus. Whether certain usage
makes sense or not surely is debatable but I can't imagine all use
cases where 2MB percpu TLB entry could be useful would be senseless.

> The most common user of per cpu data I am aware of is allocating one
> word per cpu for counters.
>
> What would be better is simply to:
> - Require a lock to access another cpus per cpu data.
> - Do large page allocations for the per cpu data.
>
> At which point we could grow the per cpu data by simply reallocating it on
> each cpu and updating the register that holds the base pointer.

I don't think moving live objects is such a good idea for the
following reasons.

1. Programming convenience is usually much more important than people
think it is. Even in the kernel. I think it's very likely that
we'll have unending stream of small feature requirements which
would step just outside the supported bounds and ever smart
workaround until the restriction is finally removed years later.

2. Moving live objects is inherently dangerous + it won't happen
often. Thinking about possible subtle bugs is scary.

Thanks.

--
tejun