]> err.no Git - linux-2.6/blobdiff - mm/vmscan.c
[PATCH] readahead: backoff on I/O error
[linux-2.6] / mm / vmscan.c
index 46be8a02280e70f1526e518a820340977a3afc69..72babac71deaba28f9c75a1b6d2ccacb8ba537fa 100644 (file)
@@ -110,7 +110,7 @@ struct shrinker {
  * From 0 .. 100.  Higher means more swappy.
  */
 int vm_swappiness = 60;
-static long total_memory;
+long vm_total_pages;   /* The total number of pages which the VM controls */
 
 static LIST_HEAD(shrinker_list);
 static DECLARE_RWSEM(shrinker_rwsem);
@@ -290,11 +290,23 @@ static void handle_write_error(struct address_space *mapping,
        unlock_page(page);
 }
 
+/* possible outcome of pageout() */
+typedef enum {
+       /* failed to write page out, page is locked */
+       PAGE_KEEP,
+       /* move page to the active list, page is locked */
+       PAGE_ACTIVATE,
+       /* page has been sent to the disk successfully, page is unlocked */
+       PAGE_SUCCESS,
+       /* page is clean and locked */
+       PAGE_CLEAN,
+} pageout_t;
+
 /*
  * pageout is called by shrink_page_list() for each dirty page.
  * Calls ->writepage().
  */
-pageout_t pageout(struct page *page, struct address_space *mapping)
+static pageout_t pageout(struct page *page, struct address_space *mapping)
 {
        /*
         * If the page is dirty, only perform writeback if that write
@@ -339,6 +351,8 @@ pageout_t pageout(struct page *page, struct address_space *mapping)
                struct writeback_control wbc = {
                        .sync_mode = WB_SYNC_NONE,
                        .nr_to_write = SWAP_CLUSTER_MAX,
+                       .range_start = 0,
+                       .range_end = LLONG_MAX,
                        .nonblocking = 1,
                        .for_reclaim = 1,
                };
@@ -729,7 +743,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
                 * how much memory
                 * is mapped.
                 */
-               mapped_ratio = (sc->nr_mapped * 100) / total_memory;
+               mapped_ratio = (sc->nr_mapped * 100) / vm_total_pages;
 
                /*
                 * Now decide how much we really want to unmap some pages.  The
@@ -1468,7 +1482,6 @@ static int __init kswapd_init(void)
                pgdat->kswapd = find_task_by_pid(pid);
                read_unlock(&tasklist_lock);
        }
-       total_memory = nr_free_pagecache_pages();
        hotcpu_notifier(cpu_callback, 0);
        return 0;
 }