diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2008-10-18 23:26:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 11:50:25 -0400 |
commit | f04e9ebbe4909f9a41efd55149bc353299f4e83b (patch) | |
tree | 4ff31c7f918edafe7d4e4dd0e926b6ac545c7897 /include/linux | |
parent | b69408e88bd86b98feb7b9a38fd865e1ddb29827 (diff) |
swap: use an array for the LRU pagevecs
Turn the pagevecs into an array just like the LRUs. This significantly
cleans up the source code and reduces the size of the kernel by about 13kB
after all the LRU lists have been created further down in the split VM
patch series.
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/pagevec.h | 13 | ||||
-rw-r--r-- | include/linux/swap.h | 18 |
2 files changed, 27 insertions, 4 deletions
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 8eb7fa76c1d0..6b8f11bcc948 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h | |||
@@ -23,8 +23,7 @@ struct pagevec { | |||
23 | void __pagevec_release(struct pagevec *pvec); | 23 | void __pagevec_release(struct pagevec *pvec); |
24 | void __pagevec_release_nonlru(struct pagevec *pvec); | 24 | void __pagevec_release_nonlru(struct pagevec *pvec); |
25 | void __pagevec_free(struct pagevec *pvec); | 25 | void __pagevec_free(struct pagevec *pvec); |
26 | void __pagevec_lru_add(struct pagevec *pvec); | 26 | void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); |
27 | void __pagevec_lru_add_active(struct pagevec *pvec); | ||
28 | void pagevec_strip(struct pagevec *pvec); | 27 | void pagevec_strip(struct pagevec *pvec); |
29 | unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, | 28 | unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, |
30 | pgoff_t start, unsigned nr_pages); | 29 | pgoff_t start, unsigned nr_pages); |
@@ -81,6 +80,16 @@ static inline void pagevec_free(struct pagevec *pvec) | |||
81 | __pagevec_free(pvec); | 80 | __pagevec_free(pvec); |
82 | } | 81 | } |
83 | 82 | ||
83 | static inline void __pagevec_lru_add(struct pagevec *pvec) | ||
84 | { | ||
85 | ____pagevec_lru_add(pvec, LRU_INACTIVE); | ||
86 | } | ||
87 | |||
88 | static inline void __pagevec_lru_add_active(struct pagevec *pvec) | ||
89 | { | ||
90 | ____pagevec_lru_add(pvec, LRU_ACTIVE); | ||
91 | } | ||
92 | |||
84 | static inline void pagevec_lru_add(struct pagevec *pvec) | 93 | static inline void pagevec_lru_add(struct pagevec *pvec) |
85 | { | 94 | { |
86 | if (pagevec_count(pvec)) | 95 | if (pagevec_count(pvec)) |
diff --git a/include/linux/swap.h b/include/linux/swap.h index de40f169a4e4..fcc169610d09 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -171,8 +171,8 @@ extern unsigned int nr_free_pagecache_pages(void); | |||
171 | 171 | ||
172 | 172 | ||
173 | /* linux/mm/swap.c */ | 173 | /* linux/mm/swap.c */ |
174 | extern void lru_cache_add(struct page *); | 174 | extern void __lru_cache_add(struct page *, enum lru_list lru); |
175 | extern void lru_cache_add_active(struct page *); | 175 | extern void lru_cache_add_lru(struct page *, enum lru_list lru); |
176 | extern void activate_page(struct page *); | 176 | extern void activate_page(struct page *); |
177 | extern void mark_page_accessed(struct page *); | 177 | extern void mark_page_accessed(struct page *); |
178 | extern void lru_add_drain(void); | 178 | extern void lru_add_drain(void); |
@@ -180,6 +180,20 @@ extern int lru_add_drain_all(void); | |||
180 | extern void rotate_reclaimable_page(struct page *page); | 180 | extern void rotate_reclaimable_page(struct page *page); |
181 | extern void swap_setup(void); | 181 | extern void swap_setup(void); |
182 | 182 | ||
183 | /** | ||
184 | * lru_cache_add: add a page to the page lists | ||
185 | * @page: the page to add | ||
186 | */ | ||
187 | static inline void lru_cache_add(struct page *page) | ||
188 | { | ||
189 | __lru_cache_add(page, LRU_INACTIVE); | ||
190 | } | ||
191 | |||
192 | static inline void lru_cache_add_active(struct page *page) | ||
193 | { | ||
194 | __lru_cache_add(page, LRU_ACTIVE); | ||
195 | } | ||
196 | |||
183 | /* linux/mm/vmscan.c */ | 197 | /* linux/mm/vmscan.c */ |
184 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | 198 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |
185 | gfp_t gfp_mask); | 199 | gfp_t gfp_mask); |