-
Notifications
You must be signed in to change notification settings - Fork 113
Commit 20a745a
committed
Replace LFU with LRU cache replacement policy
The LFU (least-frequently-used) cache replacement policy would be
inefficient when the cache is not big enough to hold all translated
blocks (IRs). For example, there are two new entries going to be
inserted to cache. They would evict each other because the other one
has the least used times. This could cause the inefficiency in cache
and make the cache-hit ratio fallen.
The LRU (least-recently-used) cache replacement policy is more suitable
for our needs. However, when the least used cache is evicted from the
cache, the counter which is used to trigger JIT compilation is going to
be lost.
To address this issue, this patch introduces the degenerated adaptive
replacement cache (ARC) which has only LRU part and its ghost list. The
evicted entries will be temporarily preserved in the ghost list as the
history. If the key of inserted entry matches the one in the ghost list,
the history will be freed, and the frequency mentioned above would be
inherited by the new entry.
The performance difference between the original implementation and this
patch is shown below:
* 1024 entries (10 bits)
| Matric | Original | Patched |
|-----------|----------------|----------------|
| dhrystone | 17720 DMIPS | 17660 DMIPS |
| coremark | 5540 iters/s | 5550 iters/s |
| aes | 9.164 s | 9.084 s |
| nqueens | 1.551 s | 1.493 s |
| hamilton | 12.917 s | 12.565 s |
* 256 entries (8 bits)
| Matric | Original | Patched |
|-----------|----------------|----------------|
| dhrystone | 17420 DMIPS | 18025 DMIPS |
| coremark | 48 iters/s | 5575 iters/s |
| aes | 8.904 s | 8.834 s |
| nqueens | 6.416 s | 1.348 s |
| hamilton | 3400 s | 13.004 s |
* 64 entries (6 bits)
| Matric | Original | Patched |
|-----------|----------------|----------------|
| dhrystone | 17720 DMIPS | 17850 DMIPS |
| coremark | (timeout) | 215 iters/s |
| aes | 342 s | 8.882 s |
| nqueens | 680 s | 1.506 s |
| hamilton | (timeout) | 13.724 s |
* Experimental Linux Kernel booting: 126s (original) -> 21s (patched)1 parent 22cd474 commit 20a745aCopy full SHA for 20a745a
0 commit comments