factor out the move_pages page freeing to a common routine.
guarantee page alignment for page allocs.
reduce variable scoping.