diff options
author | Hugh Dickins <hugh@veritas.com> | 2005-11-22 00:32:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-22 12:13:42 -0500 |
commit | 664beed0190fae687ac51295694004902ddeb18e (patch) | |
tree | 89a7c8d9d541fb678c567834cb758fc88b375d47 | |
parent | 1cdca61bf8537043edde8ef784ce1a1351361dac (diff) |
[PATCH] unpaged: unifdefed PageCompound
It looks like snd_xxx is not the only nopage to be using PageReserved as a way
of holding a high-order page together: which no longer works, but is masked by
our failure to free from VM_RESERVED areas. We cannot fix that bug without
first substituting another way to hold the high-order page together, while
farming out the 0-order pages from within it.
That's just what PageCompound is designed for, but it's been kept under
CONFIG_HUGETLB_PAGE. Remove the #ifdefs: which saves some space (out- of-line
put_page), doesn't slow down what most needs to be fast (already using
hugetlb), and unifies the way we handle high-order pages.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/mm.h | 19 | ||||
-rw-r--r-- | include/linux/page-flags.h | 4 | ||||
-rw-r--r-- | mm/page_alloc.c | 5 | ||||
-rw-r--r-- | mm/swap.c | 3 |
4 files changed, 0 insertions, 31 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 0986d19be0b7..9701210c6680 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -311,8 +311,6 @@ struct page { | |||
311 | 311 | ||
312 | extern void FASTCALL(__page_cache_release(struct page *)); | 312 | extern void FASTCALL(__page_cache_release(struct page *)); |
313 | 313 | ||
314 | #ifdef CONFIG_HUGETLB_PAGE | ||
315 | |||
316 | static inline int page_count(struct page *page) | 314 | static inline int page_count(struct page *page) |
317 | { | 315 | { |
318 | if (PageCompound(page)) | 316 | if (PageCompound(page)) |
@@ -329,23 +327,6 @@ static inline void get_page(struct page *page) | |||
329 | 327 | ||
330 | void put_page(struct page *page); | 328 | void put_page(struct page *page); |
331 | 329 | ||
332 | #else /* CONFIG_HUGETLB_PAGE */ | ||
333 | |||
334 | #define page_count(p) (atomic_read(&(p)->_count) + 1) | ||
335 | |||
336 | static inline void get_page(struct page *page) | ||
337 | { | ||
338 | atomic_inc(&page->_count); | ||
339 | } | ||
340 | |||
341 | static inline void put_page(struct page *page) | ||
342 | { | ||
343 | if (put_page_testzero(page)) | ||
344 | __page_cache_release(page); | ||
345 | } | ||
346 | |||
347 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
348 | |||
349 | /* | 330 | /* |
350 | * Multiple processes may "see" the same page. E.g. for untouched | 331 | * Multiple processes may "see" the same page. E.g. for untouched |
351 | * mappings of /dev/null, all processes see the same page full of | 332 | * mappings of /dev/null, all processes see the same page full of |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f34767c5fc79..343083fec258 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -287,11 +287,7 @@ extern void __mod_page_state(unsigned long offset, unsigned long delta); | |||
287 | #define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags) | 287 | #define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags) |
288 | #define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags) | 288 | #define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags) |
289 | 289 | ||
290 | #ifdef CONFIG_HUGETLB_PAGE | ||
291 | #define PageCompound(page) test_bit(PG_compound, &(page)->flags) | 290 | #define PageCompound(page) test_bit(PG_compound, &(page)->flags) |
292 | #else | ||
293 | #define PageCompound(page) 0 | ||
294 | #endif | ||
295 | #define SetPageCompound(page) set_bit(PG_compound, &(page)->flags) | 291 | #define SetPageCompound(page) set_bit(PG_compound, &(page)->flags) |
296 | #define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) | 292 | #define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) |
297 | 293 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bd4de592dc23..23b84c4e1a57 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -148,10 +148,6 @@ static void bad_page(const char *function, struct page *page) | |||
148 | add_taint(TAINT_BAD_PAGE); | 148 | add_taint(TAINT_BAD_PAGE); |
149 | } | 149 | } |
150 | 150 | ||
151 | #ifndef CONFIG_HUGETLB_PAGE | ||
152 | #define prep_compound_page(page, order) do { } while (0) | ||
153 | #define destroy_compound_page(page, order) do { } while (0) | ||
154 | #else | ||
155 | /* | 151 | /* |
156 | * Higher-order pages are called "compound pages". They are structured thusly: | 152 | * Higher-order pages are called "compound pages". They are structured thusly: |
157 | * | 153 | * |
@@ -205,7 +201,6 @@ static void destroy_compound_page(struct page *page, unsigned long order) | |||
205 | ClearPageCompound(p); | 201 | ClearPageCompound(p); |
206 | } | 202 | } |
207 | } | 203 | } |
208 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
209 | 204 | ||
210 | /* | 205 | /* |
211 | * function for dealing with page's order in buddy system. | 206 | * function for dealing with page's order in buddy system. |
@@ -34,8 +34,6 @@ | |||
34 | /* How many pages do we try to swap or page in/out together? */ | 34 | /* How many pages do we try to swap or page in/out together? */ |
35 | int page_cluster; | 35 | int page_cluster; |
36 | 36 | ||
37 | #ifdef CONFIG_HUGETLB_PAGE | ||
38 | |||
39 | void put_page(struct page *page) | 37 | void put_page(struct page *page) |
40 | { | 38 | { |
41 | if (unlikely(PageCompound(page))) { | 39 | if (unlikely(PageCompound(page))) { |
@@ -52,7 +50,6 @@ void put_page(struct page *page) | |||
52 | __page_cache_release(page); | 50 | __page_cache_release(page); |
53 | } | 51 | } |
54 | EXPORT_SYMBOL(put_page); | 52 | EXPORT_SYMBOL(put_page); |
55 | #endif | ||
56 | 53 | ||
57 | /* | 54 | /* |
58 | * Writeback is about to end against a page which has been marked for immediate | 55 | * Writeback is about to end against a page which has been marked for immediate |