The difference between D-Cache writeback and writethrough policies on omap5912, omap2420. | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Dear all.
I work on OMAP5912, OMAP2420 boards to check cache performance and to
compare writeback and writethrough policies using lmbench tool.
And I figured out some strange behavior, which I cannot understand.
If read/write data size is smaller than cache size, then memory
read/write operations are performed fully in D-cache memory.
For memory read test of the lmbench (table 1) I see cache effect,
otherwise there is no cache effect in case of memory write/partial
write(see table 2, 3).
Why is there no cache effect in case of memory write test on ARM Arch?
While another architectures (MIPS, x86) do have cache effect in both
memory read and memory write cases.
Furthermore, why is there no performance difference between writeback
and writethrough policies in case of memory write test(table 2, 3),
while it does exist in case of partial read/write test?
As you may know, ARM supports both readallocate and writeallocate
cache allocation policies. By default, ARM kernel uses readallocate
cache allocation policy and write-back cache write policy.
So I tried to change the kernel cache allocation policy from
readallocate to writeallocate, but I got the almost same results.
* Test env
----------------------------------------------------------------------------
OMAP5912(arm926) | OMAP2420(arm1136)
kernel: 2.6.18 | 2.6.24
gcc : 4.2.0 | 4.2.0
lmbench: 3.0-a9 | 3.0-a9
cache : 8KB D-cache | 32KB D-cache
16KB I-cache | 32KB I-cache
kernel config :
#
# Processor Features
#
CONFIG_ARM_THUMB=y
# CONFIG_CPU_ICACHE_DISABLE is not set
# CONFIG_CPU_DCACHE_DISABLE is not set
CONFIG_CPU_DCACHE_WRITETHROUGH=y ( writethrough )
/ CONFIG_CPU_DCACHE_WRITETHROUGH is not set ( writeback - default )
------------------------------------------------------------------------------------------------------------
* write-back, writeallocate policy
--- arch/arm/mm/mmu.c.ori 2008-04-08 08:38:44.000000000 +0900
+++ arch/arm/mm/mmu.c 2008-04-08 08:39:05.000000000 +0900
@@ -46,7 +46,7 @@
#define CPOLICY_WRITETHROUGH 2
#define CPOLICY_WRITEBACK 3
#define CPOLICY_WRITEALLOC 4
-static unsigned int cachepolicy __initdata = CPOLICY_WRITEBACK;
+static unsigned int cachepolicy __initdata = CPOLICY_WRITEALLOC;
static unsigned int ecc_mask __initdata = 0;
pgprot_t pgprot_kernel;
--- arch/arm/mm/proc-v6.S.ori 2008-04-08 08:41:23.000000000 +0900
+++ arch/arm/mm/proc-v6.S 2008-04-07 17:00:21.000000000 +0900
@@ -127,6 +127,7 @@
bic r2, r1, #0x000003f0
bic r2, r2, #0x00000003
+ orr r2, r2, #PTE_EXT_TEX(1) @ TEX[0]=1 writeback, writeallocate
orr r2, r2, #PTE_EXT_AP0 | 2
tst r1, #L_PTE_WRITE
* Lmbench results
Output format is "%0.2f %.2f\n", megabytes, megabytes_per_second, i.e.,
1. rd : memory read
- measures the time to read data into the processor. It computes the
sum of an array
of integer values. It accesses every fourth word.
Memory read bandwidth
------------------------------------------------------------------------------------------
omap5912 | writeback | writethrough || omap2420 writeback
(size MB) (MB/sec) (MB/sec) (MB/sec)
------------------------------------------------------------------------------------------
0.000512 | 132.13 | 136.53 || 565.88
0.001024 | 134.30 | 134.30 || 584.18
0.002048 | 178.09 | 178.09 || 592.18
0.004096 | 136.53 | 136.53 || 600.66
0.008192 | 134.30 | 134.30 || 608.83
*0.016384 | 89.53 | 89.53 || 606.36
*0.032768 | 82.54 | 82.54 || 591.47
0.065536 | 85.89 | 85.89 || 226.45
0.131072 | 85.89 | 85.89 || 203.32
0.262144 | 86.77 | 86.75 || 202.43
0.524288 | 84.63 | 84.63 || 197.52
1.05 | 85.47 | 84.84 || 198.31
2.10 | 86.01 | 84.63 || 199.82
4.19 | 85.69 | 85.26 || 200.38
8.39 | 85.82 | 85.69 || 201.54
2. fwr : memory write
- measures the time to write data to memory. It assigns a constant
value to each memory
of an array of integer values.
Memory write bandwidth
-----------------------------------------------------------------------------------------
omap5912 | writeback | writethrough || omap2420 writeback
(size MB) (MB/sec) (MB/sec) (MB/sec)
-----------------------------------------------------------------------------------------
0.000512 | 44.52 | 44.52 || 205.92
0.001024 | 34.13 | 34.13 || 210.29
0.002048 | 48.91 | 44.77 || 212.48
0.004096 | 45.01 | 45.01 || 215.06
0.008192 | 44.77 | 44.77 || 214.25
*0.016384 | 48.76 | 44.77 || 215.81
*0.032768 | 46.68 | 46.68 || 214.53
0.065536 | 46.71 | 46.68 || 214.52
0.131072 | 47.20 | 47.20 || 214.56
0.262144 | 46.18 | 45.69 || 213.79
0.524288 | 46.43 | 46.31 || 211.66
1.05 | 46.81 | 46.37 || 211.64
2.10 | 46.91 | 46.56 || 211.3
4.19 | 46.94 | 46.61 || 211.47
8.39 | 47.00 | 46.68 || 211.35
3. wr : memory partial write
- measures the time to write data to memory. It assigns a constant
value to each memory
of an array of integer values. It accesses every fourth word.
Memory partial write bandwidth
------------------------------------------------------------------------------------------
omap5912 | writeback | writethrough || omap2420 writeback
(size MB) (MB/sec) (MB/sec) (MB/sec)
------------------------------------------------------------------------------------------
0.000512 | 136.53 | 136.53 || 749.43
0.001024 | 178.57 | 179.06 || 785.56
0.002048 | 178.09 | 180.04 || 801.23
0.004096 | 136.53 | 136.53 || 812.05
0.008192 | 178.57 | 134.30 || 822.33
*0.016384 | 180.04 | 180.04 || 820.25
*0.032768 | 179.06 | 179.06 || 821.13
0.065536 | 179.06 | 179.06 || 818.46
0.131072 | 186.71 | 186.71 || 817.5
0.262144 | 182.81 | 182.81 || 811.59
0.524288 | 182.74 | 182.74 || 770.16
1.05 | 179.89 | 178.97 || 769.03
2.10 | 180.85 | 179.43 || 764.45
4.19 | 181.79 | 180.84 || 765.24
8.39 | 182.40 | 181.44 || 767.41
4. rdwr : memory partial read/write
- measures the time to read data into memory and then write data to
the same memory location.
For each element in an array it adds the current value to a running
sum before assigning a
new (constant) value to the element. It accesses every fourth word.
Memory partial read/write bandwidth
-------------------------------------------------------------------------------------------
omap5912 | writeback | writethrough || omap2420 writeback
(size MB) (MB/sec) (MB/sec) (MB/sec)
-------------------------------------------------------------------------------------------
0.000512 | 136.53 | 132.13 || 310.41
0.001024 | 273.07 | 134.30 || 313.79
0.002048 | 528.52 | 178.09 || 316.76
0.004096 | 356.17 | 136.53 || 318.43
0.008192 | 90.02 | 90.02 || 319.29
*0.016384 | 53.72 | 67.15 || 319.19
*0.032768 | 51.12 | 67.15 || 307.74
0.065536 | 49.95 | 67.15 || 136.49
0.131072 | 49.93 | 68.16 || 122.04
0.262144 | 48.80 | 68.16 || 121.01
0.524288 | 49.37 | 66.58 || 120.5
1.05 | 49.23 | 66.72 || 120.36
2.10 | 49.26 | 66.27 || 120.47
4.19 | 49.23 | 66.75 || 119.98
8.39 | 49.23 | 66.98 || 120.12
Thanks and regards,
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
[Site Home] [Fedora ARM] [IETF Annouce] [Security] [Bugtraq] [Linux] [Linux ARM Kernel] [Linux OMAP] [Linux MIPS] [ECOS] [Tools] [DDR & Rambus] [Monitors]