Skip to content
  • Rik van Riel's avatar
    vmscan: fix pagecache reclaim referenced bit check · 7e9cd484
    Rik van Riel authored
    
    
    Moving referenced pages back to the head of the active list creates a huge
    scalability problem, because by the time a large memory system finally
    runs out of free memory, every single page in the system will have been
    referenced.
    
    Not only do we not have the time to scan every single page on the active
    list, but since they have will all have the referenced bit set, that bit
    conveys no useful information.
    
    A more scalable solution is to just move every page that hits the end of
    the active list to the inactive list.
    
    We clear the referenced bit off of mapped pages, which need just one
    reference to be moved back onto the active list.
    
    Unmapped pages will be moved back to the active list after two references
    (see mark_page_accessed).  We preserve the PG_referenced flag on unmapped
    pages to preserve accesses that were made while the page was on the active
    list.
    
    Signed-off-by: default avatarRik van Riel <riel@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7e9cd484