Browse Source

mm: munlock: batch NR_MLOCK zone state updates

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 <vbabka@suse.cz>
Reviewed-by: Jörn Engel <joern@logfs.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Michel Lespinasse <walken@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Vlastimil Babka 12 years ago
parent
commit
1ebb7cc6a5
1 changed files with 3 additions and 3 deletions
  1. 3 3
      mm/mlock.c

+ 3 - 3
mm/mlock.c

@@ -241,6 +241,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
 {
 {
 	int i;
 	int i;
 	int nr = pagevec_count(pvec);
 	int nr = pagevec_count(pvec);
+	int delta_munlocked = -nr;
 
 
 	/* Phase 1: page isolation */
 	/* Phase 1: page isolation */
 	spin_lock_irq(&zone->lru_lock);
 	spin_lock_irq(&zone->lru_lock);
@@ -251,9 +252,6 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
 			struct lruvec *lruvec;
 			struct lruvec *lruvec;
 			int lru;
 			int lru;
 
 
-			/* we have disabled interrupts */
-			__mod_zone_page_state(zone, NR_MLOCK, -1);
-
 			if (PageLRU(page)) {
 			if (PageLRU(page)) {
 				lruvec = mem_cgroup_page_lruvec(page, zone);
 				lruvec = mem_cgroup_page_lruvec(page, zone);
 				lru = page_lru(page);
 				lru = page_lru(page);
@@ -275,8 +273,10 @@ skip_munlock:
 			 */
 			 */
 			pvec->pages[i] = NULL;
 			pvec->pages[i] = NULL;
 			put_page(page);
 			put_page(page);
+			delta_munlocked++;
 		}
 		}
 	}
 	}
+	__mod_zone_page_state(zone, NR_MLOCK, delta_munlocked);
 	spin_unlock_irq(&zone->lru_lock);
 	spin_unlock_irq(&zone->lru_lock);
 
 
 	/* Phase 2: page munlock and putback */
 	/* Phase 2: page munlock and putback */