/* ksm_do_scan - the ksm scanner main worker function. @scan_npages - number of pages we want to scan before we return.  */
static void ksm_do_scan(unsigned int scan_npages)
/* ksm_do_scan - the ksm scanner main worker function. @scan_npages - number of pages we want to scan before we return.  */
static void ksm_do_scan(unsigned int scan_npages)
{
	struct rmap_item *rmap_item;
	struct page *page;
	while (scan_npages--) {
		cond_resched();
		rmap_item = scan_get_next_rmap_item(&page);
		if (!rmap_item)
			return;
		if (!PageKsm(page) || !in_stable_tree(rmap_item))
			cmp_and_merge_page(page, rmap_item);
		put_page(page);
	}
}