/* Note: it is possible that get_ksm_page() will return NULL one moment, then page the next, if the page is in between page_freeze_refs() and page_unfreeze_refs(): this shouldn't be a problem anywhere, the page is on its way to being freed; but it is an anomaly to bear in mind.  */
static struct page* get_ksm_page(struct stable_node *stable_node)
/* Note: it is possible that get_ksm_page() will return NULL one moment, then page the next, if the page is in between page_freeze_refs() and page_unfreeze_refs(): this shouldn't be a problem anywhere, the page is on its way to being freed; but it is an anomaly to bear in mind.  */
static struct page* get_ksm_page(struct stable_node *stable_node)
{
	struct page *page;
	void *expected_mapping;
	page = pfn_to_page(stable_node->kpfn);
	expected_mapping = (void *)stable_node +
				(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
	rcu_read_lock();
	if (page->mapping != expected_mapping)
		goto stale;
	if (!get_page_unless_zero(page))
		goto stale;
	if (page->mapping != expected_mapping) {
		put_page(page);
		goto stale;
	}
	rcu_read_unlock();
	return page;
stale:
	rcu_read_unlock();
	remove_node_from_stable_tree(stable_node);
	return NULL;
}