Readahead: the documentation I wanted to read
Readahead: the documentation I wanted to read
Posted Apr 10, 2022 11:29 UTC (Sun) by donald.buczek (subscriber, #112892)Parent article: Readahead: the documentation I wanted to read
A year or so ago I dug my way through the code without the help of your new documentation, because I was looking for a way to fix something, which I think is sub-optimal behavior of mm: We've noticed that a single sequential read of a single big file (bigger than the memory available for the page cache) triggers the shrinkers and makes you lose all your valuable caches for the never-again needed data from the big file.
As the readahead code is in a position to detect sequential access patterns and has access to the information of the backing file (is it "big"?) , I wonder, if that was the right place to detect the scenario and maybe drop specific pages from that file before more valuable pages and other caches are affected.
I made some experiments with the detection part, which in our use-case is complicated by the fact, that accesses come over NFS, so they are out of order occasionally. Additional NFS drawbacks: fadvice() data not available, alternative mitigations based on cgroups not available...
I could more or less identify this pattern and do a printk to show, that an opportunity was detected, but I didn't get to the other parts, which would be
- Decide, which pages of the sequential file to scarify. LRU might not be optimal here, because if the file is read a second time, it will be from the beginning again.
- How to drop specific pages from the cache. I guess, there are a lot things which can be done wrongly.
Probably i won't get very far. Maybe other work ( multi-generational LRU? ) will help in that problem area.