lkml.org 
[lkml]   [2009]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] vmscan: evict use-once pages first (v3)
On Wed, 29 Apr 2009 13:14:36 -0400
Rik van Riel <riel@redhat.com> wrote:

> When the file LRU lists are dominated by streaming IO pages,
> evict those pages first, before considering evicting other
> pages.
>
> This should be safe from deadlocks or performance problems
> because only three things can happen to an inactive file page:
> 1) referenced twice and promoted to the active list
> 2) evicted by the pageout code
> 3) under IO, after which it will get evicted or promoted
>
> The pages freed in this way can either be reused for streaming
> IO, or allocated for something else. If the pages are used for
> streaming IO, this pageout pattern continues. Otherwise, we will
> fall back to the normal pageout pattern.
>
> ..
>
> +int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
> +{
> + unsigned long active;
> + unsigned long inactive;
> +
> + inactive = mem_cgroup_get_local_zonestat(memcg, LRU_INACTIVE_FILE);
> + active = mem_cgroup_get_local_zonestat(memcg, LRU_ACTIVE_FILE);
> +
> + return (active > inactive);
> +}

This function could trivially be made significantly more efficient by
changing it to do a single pass over all the zones of all the nodes,
rather than two passes.

> static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
> struct zone *zone, struct scan_control *sc, int priority)
> {
> int file = is_file_lru(lru);
>
> - if (lru == LRU_ACTIVE_FILE) {
> + if (lru == LRU_ACTIVE_FILE && inactive_file_is_low(zone, sc)) {
> shrink_active_list(nr_to_scan, zone, sc, priority, file);
> return 0;
> }

And it does get called rather often.


\
 
 \ /
  Last update: 2009-05-02 00:41    [from the cache]
©2003-2011 Jasper Spaans