Commit 1ebb7cc6 authored by Vlastimil Babka's avatar Vlastimil Babka Committed by Linus Torvalds

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: 's avatarVlastimil Babka <>
Reviewed-by: 's avatarJörn Engel <>
Acked-by: 's avatarMel Gorman <>
Cc: Michel Lespinasse <>
Cc: Hugh Dickins <>
Cc: Rik van Riel <>
Cc: Johannes Weiner <>
Cc: Michal Hocko <>
Cc: Vlastimil Babka <>
Signed-off-by: 's avatarAndrew Morton <>
Signed-off-by: 's avatarLinus Torvalds <>
parent 7225522b
......@@ -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 */
......@@ -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);
......@@ -275,8 +273,10 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
pvec->pages[i] = NULL;
__mod_zone_page_state(zone, NR_MLOCK, delta_munlocked);
/* Phase 2: page munlock and putback */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment