Open Boon-Jun opened 3 years ago
Hi,
You can look up https://github.com/WukLab/LegoOS/blob/master/managers/processor/pcache/evict_lru.c#L293. This kernel thread will walk through pcache set, within each set, it looks at reference bit and adjust the list (LRU).
if you want to change policies, i suggest you start from modifying sweep_pset()
. Watch out for those flags.. this code is very very racy (there might be concurrent pgfaults, mmap, munmap etc).
Hi @lastweek. Thank you for the reply last time. So I did a simple manual tracing of the code related to lru allocation & eviction, and this is how I currently understand it at a high level.
1) The allocation of a cache line is recorded within the cache set by adding it to the head of its lru list. 2) Accessing an existing cache line does not modify the lru list, and the order within the lru list stays the same. 3) Background thread sweeps through all cache sets and their respective lru lists in fixed time intervals, and if any cache line in the lru list has not been accessed for a while, move it to the back of the lru list. 4) When an eviction is required, start iterating from the back of the lru list to find a cache line that can be evicted.
May I know whether if my interpretation of the allocation & eviction is right? And if so, does disabling the background thread means the OS no longer moves the least recently accessed cache line to the back of the lru list and what we have is something similar to a FIFO page eviction?
Hi @lastweek . Thank you so much for your help last time.
After reading the paper on LegoOS and learning about the different page eviction policies available, I wanted to try them out too, but I'm unable to find their implementation in the source code of this repository.
May I ask whether if the implementation exists for us to play with?