/* After a successful try_to_unuse, if no swap is now in use, we know we can empty the mmlist. swap_lock must be held on entry and exit. Note that mmlist_lock nests inside swap_lock, and an mm must be added to the mmlist just after page_duplicate - before would be racy.  */
static void drain_mmlist(void)
/* After a successful try_to_unuse, if no swap is now in use, we know we can empty the mmlist. swap_lock must be held on entry and exit. Note that mmlist_lock nests inside swap_lock, and an mm must be added to the mmlist just after page_duplicate - before would be racy.  */
static void drain_mmlist(void)
{
	struct list_head *p, *next;
	unsigned int type;
	for (type = 0; type < nr_swapfiles; type++)
		if (swap_info[type]->inuse_pages)
			return;
	spin_lock(&mmlist_lock);
	list_for_each_safe(p, next, &init_mm.mmlist)
		list_del_init(p);
	spin_unlock(&mmlist_lock);
}