mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
mm, vmscan: move lru_lock to the node
Node-based reclaim requires node-based LRUs and locking. This is a preparation patch that just moves the lru_lock to the node so later patches are easier to review. It is a mechanical change but note this patch makes contention worse because the LRU lock is hotter and direct reclaim and kswapd can contend on the same lock even when reclaiming from different zones. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Mel Gorman <[email protected]> Reviewed-by: Minchan Kim <[email protected]> Acked-by: Johannes Weiner <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: Hillf Danton <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
75ef718405
commit
a52633d8e9
14 changed files with 75 additions and 69 deletions
30
mm/swap.c
30
mm/swap.c
|
|
@ -62,12 +62,12 @@ static void __page_cache_release(struct page *page)
|
|||
struct lruvec *lruvec;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&zone->lru_lock, flags);
|
||||
spin_lock_irqsave(zone_lru_lock(zone), flags);
|
||||
lruvec = mem_cgroup_page_lruvec(page, zone);
|
||||
VM_BUG_ON_PAGE(!PageLRU(page), page);
|
||||
__ClearPageLRU(page);
|
||||
del_page_from_lru_list(page, lruvec, page_off_lru(page));
|
||||
spin_unlock_irqrestore(&zone->lru_lock, flags);
|
||||
spin_unlock_irqrestore(zone_lru_lock(zone), flags);
|
||||
}
|
||||
mem_cgroup_uncharge(page);
|
||||
}
|
||||
|
|
@ -189,16 +189,16 @@ static void pagevec_lru_move_fn(struct pagevec *pvec,
|
|||
|
||||
if (pagezone != zone) {
|
||||
if (zone)
|
||||
spin_unlock_irqrestore(&zone->lru_lock, flags);
|
||||
spin_unlock_irqrestore(zone_lru_lock(zone), flags);
|
||||
zone = pagezone;
|
||||
spin_lock_irqsave(&zone->lru_lock, flags);
|
||||
spin_lock_irqsave(zone_lru_lock(zone), flags);
|
||||
}
|
||||
|
||||
lruvec = mem_cgroup_page_lruvec(page, zone);
|
||||
(*move_fn)(page, lruvec, arg);
|
||||
}
|
||||
if (zone)
|
||||
spin_unlock_irqrestore(&zone->lru_lock, flags);
|
||||
spin_unlock_irqrestore(zone_lru_lock(zone), flags);
|
||||
release_pages(pvec->pages, pvec->nr, pvec->cold);
|
||||
pagevec_reinit(pvec);
|
||||
}
|
||||
|
|
@ -318,9 +318,9 @@ void activate_page(struct page *page)
|
|||
struct zone *zone = page_zone(page);
|
||||
|
||||
page = compound_head(page);
|
||||
spin_lock_irq(&zone->lru_lock);
|
||||
spin_lock_irq(zone_lru_lock(zone));
|
||||
__activate_page(page, mem_cgroup_page_lruvec(page, zone), NULL);
|
||||
spin_unlock_irq(&zone->lru_lock);
|
||||
spin_unlock_irq(zone_lru_lock(zone));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -448,13 +448,13 @@ void add_page_to_unevictable_list(struct page *page)
|
|||
struct zone *zone = page_zone(page);
|
||||
struct lruvec *lruvec;
|
||||
|
||||
spin_lock_irq(&zone->lru_lock);
|
||||
spin_lock_irq(zone_lru_lock(zone));
|
||||
lruvec = mem_cgroup_page_lruvec(page, zone);
|
||||
ClearPageActive(page);
|
||||
SetPageUnevictable(page);
|
||||
SetPageLRU(page);
|
||||
add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE);
|
||||
spin_unlock_irq(&zone->lru_lock);
|
||||
spin_unlock_irq(zone_lru_lock(zone));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -744,7 +744,7 @@ void release_pages(struct page **pages, int nr, bool cold)
|
|||
* same zone. The lock is held only if zone != NULL.
|
||||
*/
|
||||
if (zone && ++lock_batch == SWAP_CLUSTER_MAX) {
|
||||
spin_unlock_irqrestore(&zone->lru_lock, flags);
|
||||
spin_unlock_irqrestore(zone_lru_lock(zone), flags);
|
||||
zone = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -759,7 +759,7 @@ void release_pages(struct page **pages, int nr, bool cold)
|
|||
|
||||
if (PageCompound(page)) {
|
||||
if (zone) {
|
||||
spin_unlock_irqrestore(&zone->lru_lock, flags);
|
||||
spin_unlock_irqrestore(zone_lru_lock(zone), flags);
|
||||
zone = NULL;
|
||||
}
|
||||
__put_compound_page(page);
|
||||
|
|
@ -771,11 +771,11 @@ void release_pages(struct page **pages, int nr, bool cold)
|
|||
|
||||
if (pagezone != zone) {
|
||||
if (zone)
|
||||
spin_unlock_irqrestore(&zone->lru_lock,
|
||||
spin_unlock_irqrestore(zone_lru_lock(zone),
|
||||
flags);
|
||||
lock_batch = 0;
|
||||
zone = pagezone;
|
||||
spin_lock_irqsave(&zone->lru_lock, flags);
|
||||
spin_lock_irqsave(zone_lru_lock(zone), flags);
|
||||
}
|
||||
|
||||
lruvec = mem_cgroup_page_lruvec(page, zone);
|
||||
|
|
@ -790,7 +790,7 @@ void release_pages(struct page **pages, int nr, bool cold)
|
|||
list_add(&page->lru, &pages_to_free);
|
||||
}
|
||||
if (zone)
|
||||
spin_unlock_irqrestore(&zone->lru_lock, flags);
|
||||
spin_unlock_irqrestore(zone_lru_lock(zone), flags);
|
||||
|
||||
mem_cgroup_uncharge_list(&pages_to_free);
|
||||
free_hot_cold_page_list(&pages_to_free, cold);
|
||||
|
|
@ -826,7 +826,7 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
|
|||
VM_BUG_ON_PAGE(PageCompound(page_tail), page);
|
||||
VM_BUG_ON_PAGE(PageLRU(page_tail), page);
|
||||
VM_BUG_ON(NR_CPUS != 1 &&
|
||||
!spin_is_locked(&lruvec_zone(lruvec)->lru_lock));
|
||||
!spin_is_locked(zone_lru_lock(lruvec_zone(lruvec))));
|
||||
|
||||
if (!list)
|
||||
SetPageLRU(page_tail);
|
||||
|
|
|
|||
Loading…
Reference in a new issue