From: Nick Piggin Move the lock debug checks below the page reserved checks. Also, having debug_check_no_locks_freed in kernel_map_pages is wrong. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton --- include/linux/mm.h | 7 +------ mm/page_alloc.c | 8 ++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff -puN include/linux/mm.h~mm-locks_freed-fix include/linux/mm.h --- a/include/linux/mm.h~mm-locks_freed-fix +++ a/include/linux/mm.h @@ -1103,12 +1103,7 @@ static inline void vm_stat_account(struc #ifndef CONFIG_DEBUG_PAGEALLOC static inline void -kernel_map_pages(struct page *page, int numpages, int enable) -{ - if (!PageHighMem(page) && !enable) - debug_check_no_locks_freed(page_address(page), - numpages * PAGE_SIZE); -} +kernel_map_pages(struct page *page, int numpages, int enable) {} #endif extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); diff -puN mm/page_alloc.c~mm-locks_freed-fix mm/page_alloc.c --- a/mm/page_alloc.c~mm-locks_freed-fix +++ a/mm/page_alloc.c @@ -495,15 +495,13 @@ static void __free_pages_ok(struct page int i; int reserved = 0; - if (!PageHighMem(page)) - debug_check_no_locks_freed(page_address(page), - PAGE_SIZE<