Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix free memory calculation on v3.14+
arc_free_memory has been broken since an API change in Linux v3.14: 2016-07-28 599d0c95 mm, vmscan: move LRU lists to node That moved some of global_page_state() into global_node_page_state(). The API change was particularly egregious as, instead of breaking the old code, it silently did the wrong thing and we continued using global_page_state() where we should have been using global_node_page_state(), thus indexing into the wrong array via NR_SLAB_RECLAIMABLE et al. This was /nearly/ fixed in ZoL by: 2017-08-24 2209e40 Linux 4.8+ compatibility fix for vm stats ...which put in place the config infrastructure to detect the API change and fix an instance of NR_FILE_PAGES in arc_evictable_memory(). Unfortunately the free memory calculation at that time was done in SPL freemem, and the API fix wasn't applied to the SPL. As a result our free memory calculation remained broken until it was again /nearly/ fixed by: 2017-09-16 787acae Linux 3.14 compat: IO acct, global_page_state, etc 2017-09-19 661907e Linux 4.14 compat: IO acct, global_page_state, etc These two patches copy SPL freemem to arc_free_memory() and do the global_node_page_state() split, /almost/ correctly... Unfortunately they assume NR_SLAB_RECLAIMABLE moved to global_node_page_state() along with NR_INACTIVE_FILE and NR_INACTIVE_ANON, but NR_SLAB_RECLAIMABLE actually stayed in global_page_state(), thus leaving our free memory calculation broken for 19 months on Linux v3.14+ - until now! Additionally, Linux 4.14 changes global_page_state() to global_zone_page_state(), so fix that as well Signed-off-by: Chris Dunlop <chris@onthe.net.au>
- Loading branch information