Skip to content

Commit

Permalink
mm: munlock: batch NR_MLOCK zone state updates
Browse files Browse the repository at this point in the history
Depending on previous batch which introduced batched isolation in
munlock_vma_range(), we can batch also the updates of NR_MLOCK page stats.
 After the whole pagevec is processed for page isolation, the stats are
updated only once with the number of successful isolations.  There were
however no measurable perfomance gains.

Signed-off-by: Vlastimil Babka <[email protected]>
Reviewed-by: Jörn Engel <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Cc: Michel Lespinasse <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
tehcaster authored and torvalds committed Sep 11, 2013
1 parent 7225522 commit 1ebb7cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
{
int i;
int nr = pagevec_count(pvec);
int delta_munlocked = -nr;

/* Phase 1: page isolation */
spin_lock_irq(&zone->lru_lock);
Expand All @@ -251,9 +252,6 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
struct lruvec *lruvec;
int lru;

/* we have disabled interrupts */
__mod_zone_page_state(zone, NR_MLOCK, -1);

if (PageLRU(page)) {
lruvec = mem_cgroup_page_lruvec(page, zone);
lru = page_lru(page);
Expand All @@ -275,8 +273,10 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
*/
pvec->pages[i] = NULL;
put_page(page);
delta_munlocked++;
}
}
__mod_zone_page_state(zone, NR_MLOCK, delta_munlocked);
spin_unlock_irq(&zone->lru_lock);

/* Phase 2: page munlock and putback */
Expand Down

0 comments on commit 1ebb7cc

Please sign in to comment.