diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 76a394812776f245307ca689bac03d8e486e3d21..d51543de1813087f5562ced99a735206aefe55ef 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -806,18 +806,11 @@ static inline bool page_expected_state(struct page *page, return true; } -static inline int free_pages_check(struct page *page) +static void free_pages_check_bad(struct page *page) { const char *bad_reason; unsigned long bad_flags; - if (page_expected_state(page, PAGE_FLAGS_CHECK_AT_FREE)) { - page_cpupid_reset_last(page); - page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; - return 0; - } - - /* Something has gone sideways, find it */ bad_reason = NULL; bad_flags = 0; @@ -836,6 +829,18 @@ static inline int free_pages_check(struct page *page) bad_reason = "page still charged to cgroup"; #endif bad_page(page, bad_reason, bad_flags); +} + +static inline int free_pages_check(struct page *page) +{ + if (likely(page_expected_state(page, PAGE_FLAGS_CHECK_AT_FREE))) { + page_cpupid_reset_last(page); + page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; + return 0; + } + + /* Something has gone sideways, find it */ + free_pages_check_bad(page); return 1; }