diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 35b92d81692f098efc911cbdd334182a96c546a8..958f32545064c00e7fd9bd2e56986cb4b0f51480 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1588,6 +1588,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
 
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 	pte_unmap_unlock(orig_pte, ptl);
+	cond_resched();
 	return 0;
 }
 #ifdef CONFIG_HUGETLB_PAGE