lkml.org 
[lkml]   [2009]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] tlb flush_data: replace per_cpu with an array

* Andi Kleen <andi@firstfloor.org> wrote:

> On Mon, Jan 12, 2009 at 10:35:42PM +0100, Frederik Deweerdt 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).
>
> Nope it doesn't save memory on most systems because per cpu is only
> allocated based on the CPUs that are actually there. And if you have
> more than 8 cores you can likely afford a few bytes per CPU.

No distro kernel will build with less than 8 CPUs anyway so this point is
moot.

> You would need to cache line pad each entry then, otherwise you risk
> false sharing. [...]

They are already cache line padded.

> [...] That would make the array 1K on 128 bytes cache line system.

512 bytes.

> [...] This means on small systems this would actually waste much more
> memory.

Really small systems will be UP and wont do cross-CPU TLB flushes, so if
they are a worry the flush code can be UP optimized. (Nobody bothered so
far.)

Ingo


\
 
 \ /
  Last update: 2009-01-12 23:57    [W:0.135 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site