Commit acba6041 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] vmscan.c: shuffle things around

Move all the data structure declarations, macros and variable definitions to
less surprising places.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0342e162
...@@ -38,11 +38,49 @@ ...@@ -38,11 +38,49 @@
#include <linux/swapops.h> #include <linux/swapops.h>
/* 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;
struct scan_control {
/* Ask refill_inactive_zone, or shrink_cache to scan this many pages */
unsigned long nr_to_scan;
/* Incremented by the number of inactive pages that were scanned */
unsigned long nr_scanned;
/* Incremented by the number of pages reclaimed */
unsigned long nr_reclaimed;
unsigned long nr_mapped; /* From page_state */
/* Ask shrink_caches, or shrink_zone to scan at this priority */
unsigned int priority;
/* This context's GFP mask */
unsigned int gfp_mask;
int may_writepage;
};
/* /*
* From 0 .. 100. Higher means more swappy. * The list of shrinker callbacks used by to apply pressure to
* ageable caches.
*/ */
int vm_swappiness = 60; struct shrinker {
static long total_memory; shrinker_t shrinker;
struct list_head list;
int seeks; /* seeks to recreate an obj */
long nr; /* objs pending delete */
};
#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru)) #define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
...@@ -75,15 +113,10 @@ static long total_memory; ...@@ -75,15 +113,10 @@ static long total_memory;
#endif #endif
/* /*
* The list of shrinker callbacks used by to apply pressure to * From 0 .. 100. Higher means more swappy.
* ageable caches.
*/ */
struct shrinker { int vm_swappiness = 60;
shrinker_t shrinker; static long total_memory;
struct list_head list;
int seeks; /* seeks to recreate an obj */
long nr; /* objs pending delete */
};
static LIST_HEAD(shrinker_list); static LIST_HEAD(shrinker_list);
static DECLARE_MUTEX(shrinker_sem); static DECLARE_MUTEX(shrinker_sem);
...@@ -106,7 +139,6 @@ struct shrinker *set_shrinker(int seeks, shrinker_t theshrinker) ...@@ -106,7 +139,6 @@ struct shrinker *set_shrinker(int seeks, shrinker_t theshrinker)
} }
return shrinker; return shrinker;
} }
EXPORT_SYMBOL(set_shrinker); EXPORT_SYMBOL(set_shrinker);
/* /*
...@@ -119,7 +151,6 @@ void remove_shrinker(struct shrinker *shrinker) ...@@ -119,7 +151,6 @@ void remove_shrinker(struct shrinker *shrinker)
up(&shrinker_sem); up(&shrinker_sem);
kfree(shrinker); kfree(shrinker);
} }
EXPORT_SYMBOL(remove_shrinker); EXPORT_SYMBOL(remove_shrinker);
#define SHRINK_BATCH 128 #define SHRINK_BATCH 128
...@@ -239,18 +270,6 @@ static void handle_write_error(struct address_space *mapping, ...@@ -239,18 +270,6 @@ static void handle_write_error(struct address_space *mapping,
unlock_page(page); 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_list() for each dirty page. Calls ->writepage(). * pageout is called by shrink_list() for each dirty page. Calls ->writepage().
*/ */
...@@ -310,27 +329,6 @@ static pageout_t pageout(struct page *page, struct address_space *mapping) ...@@ -310,27 +329,6 @@ static pageout_t pageout(struct page *page, struct address_space *mapping)
return PAGE_CLEAN; return PAGE_CLEAN;
} }
struct scan_control {
/* Ask refill_inactive_zone, or shrink_cache to scan this many pages */
unsigned long nr_to_scan;
/* Incremented by the number of inactive pages that were scanned */
unsigned long nr_scanned;
/* Incremented by the number of pages reclaimed */
unsigned long nr_reclaimed;
unsigned long nr_mapped; /* From page_state */
/* Ask shrink_caches, or shrink_zone to scan at this priority */
unsigned int priority;
/* This context's GFP mask */
unsigned int gfp_mask;
int may_writepage;
};
/* /*
* shrink_list adds the number of reclaimed pages to sc->nr_reclaimed * shrink_list adds the number of reclaimed pages to sc->nr_reclaimed
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment