Re: [patch] tlb flush_data: replace per_cpu with an array

Ingo Molnar
2009-01-12T21:47:12Z

* Frederik Deweerdt <frederik.deweerdt@xprog.eu> wrote:

> Hi,
>
> On x86_64 flush tlb data is stored in per_cpu variables. This is
> unnecessary because only the first NUM_INVALIDATE_TLB_VECTORS entries
> are accessed.
>
> This patch aims at making the code less confusing (there's nothing
> really "per_cpu") by using a plain array. It also would save some memory
> on most distros out there (Ubuntu x86_64 has NR_CPUS=64 by default).

indeed, well spotted!

This construct was indeed an abuse of the per_cpu facilities.

Note that beyond the obvious memory savings, your patch should make the
code a bit faster and a bit smaller as well in the SMP TLB flush codepath:
the smp_flush_state data structure is 64 (or 128) bytes so static array
arithmetics will be faster than the per_cpu indirection.

I have applied your patch to tip/x86/mm, thanks Frederik!

Ingo