Index: current/mm/memory.c =================================================================== --- current.orig/mm/memory.c 2007-02-03 18:15:59.000000000 -0800 +++ current/mm/memory.c 2007-02-03 18:16:08.000000000 -0800 @@ -683,7 +683,11 @@ static unsigned long zap_pte_range(struc } page_remove_rmap(page, vma); if (vma->vm_flags & VM_LOCKED) { - __dec_zone_page_state(page, NR_MLOCK); + /* + * Signal that we need to decrement + * NR_MLOCKED if we put this page on the LRU + */ + PageActive(page); lru_cache_add_active(page); } tlb_remove_page(tlb, page); Index: current/mm/swap.c =================================================================== --- current.orig/mm/swap.c 2007-02-03 18:15:59.000000000 -0800 +++ current/mm/swap.c 2007-02-03 18:16:08.000000000 -0800 @@ -422,7 +422,8 @@ void __pagevec_lru_add_active(struct pag } VM_BUG_ON(PageLRU(page)); SetPageLRU(page); - VM_BUG_ON(PageActive(page)); + if (PageActive(page)) + __dec_zone_state(zone, NR_MLOCK); SetPageActive(page); add_page_to_active_list(zone, page); } Index: current/mm/vmscan.c =================================================================== --- current.orig/mm/vmscan.c 2007-02-03 18:15:59.000000000 -0800 +++ current/mm/vmscan.c 2007-02-03 18:16:08.000000000 -0800 @@ -597,6 +597,7 @@ free_it: mlocked: unlock_page(page); + ClearPageActive(page); __inc_zone_page_state(page, NR_MLOCK); continue;