Skip to content

Commit

Permalink
vmscan: shrink_active_list(): reduce lru_lock hold time
Browse files Browse the repository at this point in the history
These three statements manipulate local variables and do not need the lock
coverage.

Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Cc: Rik van Riel <riel@redhat.com
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Jan 6, 2009
1 parent 1e9e636 commit b555749
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,13 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
list_add(&page->lru, &l_inactive);
}

/*
* Move the pages to the [file or anon] inactive list.
*/
pagevec_init(&pvec, 1);
pgmoved = 0;
lru = LRU_BASE + file * LRU_FILE;

spin_lock_irq(&zone->lru_lock);
/*
* Count referenced pages from currently used mappings as
Expand All @@ -1247,13 +1254,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
if (scan_global_lru(sc))
zone->recent_rotated[!!file] += pgmoved;

/*
* Move the pages to the [file or anon] inactive list.
*/
pagevec_init(&pvec, 1);

pgmoved = 0;
lru = LRU_BASE + file * LRU_FILE;
while (!list_empty(&l_inactive)) {
page = lru_to_page(&l_inactive);
prefetchw_prev_lru_page(page, &l_inactive, flags);
Expand Down

0 comments on commit b555749

Please sign in to comment.