Skip to content

Commit fb8d14e

Browse files
Wu FengguangLinus Torvalds
authored andcommitted
[PATCH] mm: shrink_inactive_lis() nr_scan accounting fix
In shrink_inactive_list(), nr_scan is not accounted when nr_taken is 0. But 0 pages taken does not mean 0 pages scanned. Move the goto statement below the accounting code to fix it. Signed-off-by: Wu Fengguang <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent c9b02d9 commit fb8d14e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mm/vmscan.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,6 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
11321132
zone->pages_scanned += nr_scan;
11331133
spin_unlock_irq(&zone->lru_lock);
11341134

1135-
if (nr_taken == 0)
1136-
goto done;
1137-
11381135
nr_scanned += nr_scan;
11391136
nr_freed = shrink_page_list(&page_list, sc);
11401137
nr_reclaimed += nr_freed;
@@ -1146,6 +1143,9 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
11461143
__mod_page_state_zone(zone, pgscan_direct, nr_scan);
11471144
__mod_page_state_zone(zone, pgsteal, nr_freed);
11481145

1146+
if (nr_taken == 0)
1147+
goto done;
1148+
11491149
spin_lock(&zone->lru_lock);
11501150
/*
11511151
* Put back any unfreeable pages.
@@ -1166,8 +1166,9 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
11661166
}
11671167
}
11681168
} while (nr_scanned < max_scan);
1169-
spin_unlock_irq(&zone->lru_lock);
1169+
spin_unlock(&zone->lru_lock);
11701170
done:
1171+
local_irq_enable();
11711172
pagevec_release(&pvec);
11721173
return nr_reclaimed;
11731174
}

0 commit comments

Comments
 (0)