Skip to content

Commit 785b99f

Browse files
gormanmtorvalds
authored andcommitted
mm, vmscan: release/reacquire lru_lock on pgdat change
With node-lru, the locking is based on the pgdat. As Minchan pointed out, there is an opportunity to reduce LRU lock release/acquire in check_move_unevictable_pages by only changing lock on a pgdat change. [[email protected]: remove double initialisation] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Mel Gorman <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 22fecdf commit 785b99f

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

mm/vmscan.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3774,24 +3774,23 @@ int page_evictable(struct page *page)
37743774
void check_move_unevictable_pages(struct page **pages, int nr_pages)
37753775
{
37763776
struct lruvec *lruvec;
3777-
struct zone *zone = NULL;
3777+
struct pglist_data *pgdat = NULL;
37783778
int pgscanned = 0;
37793779
int pgrescued = 0;
37803780
int i;
37813781

37823782
for (i = 0; i < nr_pages; i++) {
37833783
struct page *page = pages[i];
3784-
struct zone *pagezone;
3784+
struct pglist_data *pagepgdat = page_pgdat(page);
37853785

37863786
pgscanned++;
3787-
pagezone = page_zone(page);
3788-
if (pagezone != zone) {
3789-
if (zone)
3790-
spin_unlock_irq(zone_lru_lock(zone));
3791-
zone = pagezone;
3792-
spin_lock_irq(zone_lru_lock(zone));
3787+
if (pagepgdat != pgdat) {
3788+
if (pgdat)
3789+
spin_unlock_irq(&pgdat->lru_lock);
3790+
pgdat = pagepgdat;
3791+
spin_lock_irq(&pgdat->lru_lock);
37933792
}
3794-
lruvec = mem_cgroup_page_lruvec(page, zone->zone_pgdat);
3793+
lruvec = mem_cgroup_page_lruvec(page, pgdat);
37953794

37963795
if (!PageLRU(page) || !PageUnevictable(page))
37973796
continue;
@@ -3807,10 +3806,10 @@ void check_move_unevictable_pages(struct page **pages, int nr_pages)
38073806
}
38083807
}
38093808

3810-
if (zone) {
3809+
if (pgdat) {
38113810
__count_vm_events(UNEVICTABLE_PGRESCUED, pgrescued);
38123811
__count_vm_events(UNEVICTABLE_PGSCANNED, pgscanned);
3813-
spin_unlock_irq(zone_lru_lock(zone));
3812+
spin_unlock_irq(&pgdat->lru_lock);
38143813
}
38153814
}
38163815
#endif /* CONFIG_SHMEM */

0 commit comments

Comments
 (0)