samples/c/0/swap.c
static void pagevec_move_tail(struct pagevec *pvec)
{
	int i;
	int pgmoved = 0;
	struct zone *zone = NULL;

	for (i = 0; i < pagevec_count(pvec); i++) {
		struct page *page = pvec->pages[i];
		struct zone *pagezone = page_zone(page);

		if (pagezone != zone) {
			if (zone)
				spin_unlock(&zone->lru_lock);
			zone = pagezone;
			spin_lock(&zone->lru_lock);
		}
		if (PageLRU(page) && !PageActive(page)) {
			list_move_tail(&page->lru, &zone->inactive_list);
			pgmoved++;
		}
	}
	if (zone)
		spin_unlock(&zone->lru_lock);
	__count_vm_events(PGROTATED, pgmoved);
	release_pages(pvec->pages, pvec->nr, pvec->cold);
	pagevec_reinit(pvec);
}
/*
 * pagevec_move_tail() must be called with IRQ disabled.
 * Otherwise this may cause nasty races.
 */
pagevec_move_tail() must be called with IRQ disabled.
Otherwise this may cause nasty races.
pagevec_move_tail () must be called with IRQ disabled . Otherwise this may cause nasty races .
static void pagevec_move_tail(struct pagevec *pvec)
{
	int i;
	int pgmoved = 0;
	struct zone *zone = NULL;
	for (i = 0; i < pagevec_count(pvec); i++) {
		struct page *page = pvec->pages[i];
		struct zone *pagezone = page_zone(page);
		if (pagezone != zone) {
			if (zone)
				spin_unlock(&zone->lru_lock);
			zone = pagezone;
			spin_lock(&zone->lru_lock);
		}
		if (PageLRU(page) && !PageActive(page)) {
			list_move_tail(&page->lru, &zone->inactive_list);
			pgmoved++;
		}
	}
	if (zone)
		spin_unlock(&zone->lru_lock);
	__count_vm_events(PGROTATED, pgmoved);
	release_pages(pvec->pages, pvec->nr, pvec->cold);
	pagevec_reinit(pvec);
}
static void pagevec_move_tail ( struct pagevec * pvec ) { int i ; int pgmoved = 0 ; struct zone * zone = NULL ; for ( i = 0 ; i < pagevec_count ( pvec ) ; i ++ ) { struct page * page = pvec -> pages [ i ] ; struct zone * pagezone = page_zone ( page ) ; if ( pagezone != zone ) { if ( zone ) spin_unlock ( & zone -> lru_lock ) ; zone = pagezone ; spin_lock ( & zone -> lru_lock ) ; } if ( PageLRU ( page ) && ! PageActive ( page ) ) { list_move_tail ( & page -> lru , & zone -> inactive_list ) ; pgmoved ++ ; } } if ( zone ) spin_unlock ( & zone -> lru_lock ) ; __count_vm_events ( PGROTATED , pgmoved ) ; release_pages ( pvec -> pages , pvec -> nr , pvec -> cold ) ; pagevec_reinit ( pvec ) ; }
pagevec_move_tail() must be called with IRQ disabled.
pagevec_move_tail () must be called with IRQ disabled .