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