public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andi Kleen <andi@firstfloor.org>
Cc: Frederik Deweerdt <frederik.deweerdt@xprog.eu>,
	tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: Re: [patch] tlb flush_data: replace per_cpu with an array
Date: Tue, 13 Jan 2009 13:28:31 +0100	[thread overview]
Message-ID: <20090113122831.GB29149@elte.hu> (raw)
In-Reply-To: <20090113024337.GL23848@one.firstfloor.org>


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

> > No distro kernel will build with less than 8 CPUs anyway so this point 
> > is moot.
> 
> It has nothing to do with what the distro kernel builds with. As I 
> stated clearly in my review the per cpu data is sized based on the 
> possible map, which is discovered from the BIOS at runtime.  So if your 
> system has two cores only you will only have two copies of per cpu data.

You ignored my observation that by the time this hits distro kernels the 
usual SMP hw size will be 8 or more cores.

> With this patch on the other hand you will always have 8 copies of this 
> data; aka 1K no matter how many CPUs you have.

Firstly, it's 512 bytes (see below), secondly, with the percpu approach we 
waste far more total memory as time goes on and the average core count 
increases.

> So the description that it saves memory is flat out wrong on any system 
> with less than 8 threads (which is by far the biggest majority of 
> systems currently and in the forseeable future)
> 
> > > You would need to cache line pad each entry then, otherwise you risk 
> > > false sharing. [...]
> > 
> > They are already cache line padded.
> 
> Yes that's the problem here. 

I fail to see a problem. It has to be padded and aligned no matter where 
it is - and it is padded and aligned both before and after the patch. I 
dont know why you keep insisting that there's a problem where there is 
none.

> > > [...] That would make the array 1K on 128 bytes cache line system.
> > 
> > 512 bytes.
> 
> 8 * 128 = 1024

The default cacheline size in the x86 tree (for generic cpus) is 64 bytes, 
not 128 bytes - so the default size of the array is 512 bytes, not 1024 
bytes. (This is a change we made yesterday, so you can not have known 
about it unless you follow the x86 tree closely.)

	Ingo

  reply	other threads:[~2009-01-13 12:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 21:35 [patch] tlb flush_data: replace per_cpu with an array Frederik Deweerdt
2009-01-12 21:46 ` Ingo Molnar
2009-01-12 21:57 ` Andi Kleen
2009-01-12 22:10   ` Frederik Deweerdt
2009-01-12 22:32     ` Andi Kleen
2009-01-12 22:50       ` Ingo Molnar
2009-01-12 22:40   ` Ingo Molnar
2009-01-12 22:59     ` H. Peter Anvin
2009-01-13  2:43     ` Andi Kleen
2009-01-13 12:28       ` Ingo Molnar [this message]
2009-01-12 22:34 ` Ravikiran G Thirumalai
2009-01-12 23:00   ` Ingo Molnar
2009-01-12 23:09     ` Ingo Molnar
2009-01-13  2:14     ` Ravikiran G Thirumalai
2009-01-13 12:00     ` Peter Zijlstra
2009-01-13 12:33       ` Ingo Molnar
2009-01-13 18:13         ` Ravikiran G Thirumalai
2009-01-13 18:34           ` Ingo Molnar
2009-01-13 18:42             ` Ravikiran G Thirumalai
2009-01-14  7:31               ` Ingo Molnar
2009-01-15  7:15                 ` Ravikiran G Thirumalai
2009-01-14  9:08       ` Andi Kleen
2009-01-14 14:41         ` Frederik Deweerdt
2009-01-14 15:20           ` Andi Kleen
2009-01-14 15:10             ` Frederik Deweerdt
2009-01-12 22:54 ` Mike Travis
2009-01-12 23:51   ` Frederik Deweerdt
2009-01-12 23:57     ` Mike Travis
2009-01-13  0:01       ` Ingo Molnar
2009-01-13  3:36         ` Andi Kleen
2009-01-13 12:14           ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090113122831.GB29149@elte.hu \
    --to=mingo@elte.hu \
    --cc=andi@firstfloor.org \
    --cc=frederik.deweerdt@xprog.eu \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox