diff options
-rw-r--r-- | include/linux/page-flags.h | 24 | ||||
-rw-r--r-- | mm/page_alloc.c | 34 |
2 files changed, 27 insertions, 31 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 590cff32415d..f31debfac926 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -306,5 +306,29 @@ static inline void __ClearPageTail(struct page *page) | |||
306 | } | 306 | } |
307 | 307 | ||
308 | #endif /* !PAGEFLAGS_EXTENDED */ | 308 | #endif /* !PAGEFLAGS_EXTENDED */ |
309 | |||
310 | #define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \ | ||
311 | 1 << PG_buddy | 1 << PG_writeback | \ | ||
312 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active) | ||
313 | |||
314 | /* | ||
315 | * Flags checked in bad_page(). Pages on the free list should not have | ||
316 | * these flags set. It they are, there is a problem. | ||
317 | */ | ||
318 | #define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | 1 << PG_reclaim | 1 << PG_dirty) | ||
319 | |||
320 | /* | ||
321 | * Flags checked when a page is freed. Pages being freed should not have | ||
322 | * these flags set. It they are, there is a problem. | ||
323 | */ | ||
324 | #define PAGE_FLAGS_CHECK_AT_FREE (PAGE_FLAGS | 1 << PG_reserved) | ||
325 | |||
326 | /* | ||
327 | * Flags checked when a page is prepped for return by the page allocator. | ||
328 | * Pages being prepped should not have these flags set. It they are, there | ||
329 | * is a problem. | ||
330 | */ | ||
331 | #define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | 1 << PG_reserved | 1 << PG_dirty) | ||
332 | |||
309 | #endif /* !__GENERATING_BOUNDS_H */ | 333 | #endif /* !__GENERATING_BOUNDS_H */ |
310 | #endif /* PAGE_FLAGS_H */ | 334 | #endif /* PAGE_FLAGS_H */ |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8e83f02cd2d3..2f552955a02f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -237,16 +237,7 @@ static void bad_page(struct page *page) | |||
237 | printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n" | 237 | printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n" |
238 | KERN_EMERG "Backtrace:\n"); | 238 | KERN_EMERG "Backtrace:\n"); |
239 | dump_stack(); | 239 | dump_stack(); |
240 | page->flags &= ~(1 << PG_lru | | 240 | page->flags &= ~PAGE_FLAGS_CLEAR_WHEN_BAD; |
241 | 1 << PG_private | | ||
242 | 1 << PG_locked | | ||
243 | 1 << PG_active | | ||
244 | 1 << PG_dirty | | ||
245 | 1 << PG_reclaim | | ||
246 | 1 << PG_slab | | ||
247 | 1 << PG_swapcache | | ||
248 | 1 << PG_writeback | | ||
249 | 1 << PG_buddy ); | ||
250 | set_page_count(page, 0); | 241 | set_page_count(page, 0); |
251 | reset_page_mapcount(page); | 242 | reset_page_mapcount(page); |
252 | page->mapping = NULL; | 243 | page->mapping = NULL; |
@@ -463,16 +454,7 @@ static inline int free_pages_check(struct page *page) | |||
463 | (page->mapping != NULL) | | 454 | (page->mapping != NULL) | |
464 | (page_get_page_cgroup(page) != NULL) | | 455 | (page_get_page_cgroup(page) != NULL) | |
465 | (page_count(page) != 0) | | 456 | (page_count(page) != 0) | |
466 | (page->flags & ( | 457 | (page->flags & PAGE_FLAGS_CHECK_AT_FREE))) |
467 | 1 << PG_lru | | ||
468 | 1 << PG_private | | ||
469 | 1 << PG_locked | | ||
470 | 1 << PG_active | | ||
471 | 1 << PG_slab | | ||
472 | 1 << PG_swapcache | | ||
473 | 1 << PG_writeback | | ||
474 | 1 << PG_reserved | | ||
475 | 1 << PG_buddy )))) | ||
476 | bad_page(page); | 458 | bad_page(page); |
477 | if (PageDirty(page)) | 459 | if (PageDirty(page)) |
478 | __ClearPageDirty(page); | 460 | __ClearPageDirty(page); |
@@ -616,17 +598,7 @@ static int prep_new_page(struct page *page, int order, gfp_t gfp_flags) | |||
616 | (page->mapping != NULL) | | 598 | (page->mapping != NULL) | |
617 | (page_get_page_cgroup(page) != NULL) | | 599 | (page_get_page_cgroup(page) != NULL) | |
618 | (page_count(page) != 0) | | 600 | (page_count(page) != 0) | |
619 | (page->flags & ( | 601 | (page->flags & PAGE_FLAGS_CHECK_AT_PREP))) |
620 | 1 << PG_lru | | ||
621 | 1 << PG_private | | ||
622 | 1 << PG_locked | | ||
623 | 1 << PG_active | | ||
624 | 1 << PG_dirty | | ||
625 | 1 << PG_slab | | ||
626 | 1 << PG_swapcache | | ||
627 | 1 << PG_writeback | | ||
628 | 1 << PG_reserved | | ||
629 | 1 << PG_buddy )))) | ||
630 | bad_page(page); | 602 | bad_page(page); |
631 | 603 | ||
632 | /* | 604 | /* |