[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>

authored by Hugh Dickins and committed by Linus Torvalds 664beed0 1cdca61b

-31
-19
include/linux/mm.h
··· 311 312 extern void FASTCALL(__page_cache_release(struct page *)); 313 314 - #ifdef CONFIG_HUGETLB_PAGE 315 - 316 static inline int page_count(struct page *page) 317 { 318 if (PageCompound(page)) ··· 326 } 327 328 void put_page(struct page *page); 329 - 330 - #else /* CONFIG_HUGETLB_PAGE */ 331 - 332 - #define page_count(p) (atomic_read(&(p)->_count) + 1) 333 - 334 - static inline void get_page(struct page *page) 335 - { 336 - atomic_inc(&page->_count); 337 - } 338 - 339 - static inline void put_page(struct page *page) 340 - { 341 - if (put_page_testzero(page)) 342 - __page_cache_release(page); 343 - } 344 - 345 - #endif /* CONFIG_HUGETLB_PAGE */ 346 347 /* 348 * Multiple processes may "see" the same page. E.g. for untouched
··· 311 312 extern void FASTCALL(__page_cache_release(struct page *)); 313 314 static inline int page_count(struct page *page) 315 { 316 if (PageCompound(page)) ··· 328 } 329 330 void put_page(struct page *page); 331 332 /* 333 * Multiple processes may "see" the same page. E.g. for untouched
-4
include/linux/page-flags.h
··· 287 #define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags) 288 #define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags) 289 290 - #ifdef CONFIG_HUGETLB_PAGE 291 #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) 296 #define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) 297
··· 287 #define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags) 288 #define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags) 289 290 #define PageCompound(page) test_bit(PG_compound, &(page)->flags) 291 #define SetPageCompound(page) set_bit(PG_compound, &(page)->flags) 292 #define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) 293
-5
mm/page_alloc.c
··· 148 add_taint(TAINT_BAD_PAGE); 149 } 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 /* 156 * Higher-order pages are called "compound pages". They are structured thusly: 157 * ··· 201 ClearPageCompound(p); 202 } 203 } 204 - #endif /* CONFIG_HUGETLB_PAGE */ 205 206 /* 207 * function for dealing with page's order in buddy system.
··· 148 add_taint(TAINT_BAD_PAGE); 149 } 150 151 /* 152 * Higher-order pages are called "compound pages". They are structured thusly: 153 * ··· 205 ClearPageCompound(p); 206 } 207 } 208 209 /* 210 * function for dealing with page's order in buddy system.
-3
mm/swap.c
··· 34 /* How many pages do we try to swap or page in/out together? */ 35 int page_cluster; 36 37 - #ifdef CONFIG_HUGETLB_PAGE 38 - 39 void put_page(struct page *page) 40 { 41 if (unlikely(PageCompound(page))) { ··· 50 __page_cache_release(page); 51 } 52 EXPORT_SYMBOL(put_page); 53 - #endif 54 55 /* 56 * Writeback is about to end against a page which has been marked for immediate
··· 34 /* How many pages do we try to swap or page in/out together? */ 35 int page_cluster; 36 37 void put_page(struct page *page) 38 { 39 if (unlikely(PageCompound(page))) { ··· 52 __page_cache_release(page); 53 } 54 EXPORT_SYMBOL(put_page); 55 56 /* 57 * Writeback is about to end against a page which has been marked for immediate