[HELP] Document: /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size

Silviu Popescu silviupopescu1990 at gmail.com
Tue Apr 23 05:54:08 EDT 2013


On Tue, Apr 23, 2013 at 12:17 PM, Ren Zhen <darwin.xupt at gmail.com> wrote:
> Hi everybody,
>        For  /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size,
> I execute the cmd '#cat  coherency_line_size',then it  return '64'.
>        My OS is Ubuntu 12.04, CPU is intel core i3.
>        Here is my problem, what is coherency_line_size ? what is its usage?
>        Any help will be appreciated!

Hello,

According to [1] and [2], that would be the size of a cache line.
So, in your case, a cache line can hold 64 bytes of data.
As for the usage, when you allocate memory, your CPU aligns it to  8
or 16 bytes, depending on whether you have a 32-bit machine or a
64-bit machine.
In you wish to take advantage of the cache, you should align your
memory allocations to the cache size (64 in your case). The functions
listed at [3] assist you in doing that.
Hope this helps.

[1] http://superuser.com/questions/405355/meaning-of-files-in-cpu-folder-of-linux
[2] http://jkukunas.blogspot.ro/2009/04/determining-cache-coherency-line-size.html
[3] http://linux.die.net/man/3/valloc

--
Silviu Popescu



More information about the Kernelnewbies mailing list