Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: david.goulet@polymtl.ca (David Goulet)
Subject: [ltt-dev] liburcu cache line size
Date: Tue, 17 Aug 2010 16:53:00 -0400	[thread overview]
Message-ID: <4C6AF6AC.9050702@polymtl.ca> (raw)
In-Reply-To: <20100817205144.GA25723@Krystal>



On 10-08-17 04:51 PM, Mathieu Desnoyers wrote:
> * David Goulet (david.goulet at polymtl.ca) wrote:
>>
>>
>> On 10-08-17 04:24 PM, Mathieu Desnoyers wrote:
>>> * David Goulet (david.goulet at polymtl.ca) wrote:
>>>> On 10-08-17 03:45 PM, Mathieu Desnoyers wrote:
>>> [...]
>>>>> Yes. The performance degradation caused by cache-line bouncing is _way_
>>>>> worse than extra cache pressure.
>>>>>
>>>>
>>>> There is something I don't understand here. Correct me if (most likely)
>>>> I am wrong.
>>>>
>>>> How cache line bouncing is affected by the cache line size? If I
>>>> understand correctly, cache line bounce is the problem where CPUs shares
>>>> data and have to fetch it from CPU0 to CPU7 (between caches). And, I
>>>> surely agree, this is costly!
>>>
>>> That's ok up to here.
>>>
>>>>
>>>> However, if the size of the cache is bigger then the normal cache, you
>>>> just loose space... For arch with 64 cache line size, you loose two line
>>>> per structure aligned... How lowering down to 64 bytes will cause cache
>>>> line bouncing?
>>>
>>> Let's take the following example:
>>>
>>> A multiprocessor machine with 256 bytes cache line size.
>>> The program is built thinking the cache line size is only 128 bytes.
>>>
>>> So we allocate an array of what we hope are per-cpu variables:
>>>
>>>    malloc(nr_cpus * sizeof(struct type));
>>>
>>> Where struct type is __attribute__((aligned(128))
>>>
>>> So we end up having two structures sharing a cache-line, and these will
>>> bounce between CPUs, even though the structures are not shared: only the
>>> cache-lines are shared, because the structures happen to be on the same
>>> cache line.
>>>
>>> So for allocation of individual objects which are meant to be per-cpu,
>>> e.g. a structure controlling the per-cpu buffer, the allocator can put
>>> one structure next to another (belonging to another cpu), thus causing
>>> cache line bouncing.
>>>
>>> This phenomenon is called "false sharing".
>>>
>>
>> Very nice. That clarify yes!
>>
>> However, please refer to Intel? 64 and IA-32 Architectures Software
>> Developer's Manual Volume 3A: System Programming Guide.
>>
>> http://www.intel.com/Assets/PDF/manual/253668.pdf
>>
>> P. 527, Table 11-1
>>
>> ? Pentium 4 and Intel Xeon processors (Based on Intel NetBurst
>>   microarchitecture): 8-KByte, 4-way set associative, 64-byte cache line
>> size.
>> ? Pentium 4 and Intel Xeon processors (Based on Intel NetBurst
>>   microarchitecture): 16-KByte, 8-way set associative, 64-byte cache line
>> size.
>
> Dunno why the Linux kernel choses that for P4. But we definitely have to
> handle NUMA systems.
>

arch_numa.h ... possible?

> Mathieu
>
>>
>> David
>>
>>> Mathieu
>>>
>>>>
>>>> Thanks for your help on that!
>>>> David
>>>>
>>>
>>
>> --
>> David Goulet
>> LTTng project, DORSAL Lab.
>>
>> PGP/GPG : 1024D/16BD8563
>> BE3C 672B 9331 9796 291A  14C6 4AF7 C14B 16BD 8563
>>
>

-- 
David Goulet
LTTng project, DORSAL Lab.

PGP/GPG : 1024D/16BD8563
BE3C 672B 9331 9796 291A  14C6 4AF7 C14B 16BD 8563




  reply	other threads:[~2010-08-17 20:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17 18:30 David Goulet
2010-08-17 18:51 ` Mathieu Desnoyers
2010-08-17 19:06   ` David Goulet
2010-08-17 19:45     ` Mathieu Desnoyers
2010-08-17 19:54       ` Mathieu Desnoyers
2010-08-17 20:04         ` Alexandre Montplaisir
2010-08-17 20:27           ` Mathieu Desnoyers
2010-08-17 20:36             ` Alexandre Montplaisir
2010-08-17 20:53               ` Mathieu Desnoyers
2010-08-17 19:58       ` David Goulet
2010-08-17 20:24         ` Mathieu Desnoyers
2010-08-17 20:40           ` David Goulet
2010-08-17 20:51             ` Mathieu Desnoyers
2010-08-17 20:53               ` David Goulet [this message]
2010-08-17 20:55                 ` Mathieu Desnoyers

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=4C6AF6AC.9050702@polymtl.ca \
    --to=david.goulet@polymtl.ca \
    /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