mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
mm: remove zone_lru_lock() function, access ->lru_lock directly
We have common pattern to access lru_lock from a page pointer: zone_lru_lock(page_zone(page)) Which is silly, because it unfolds to this: &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]->zone_pgdat->lru_lock while we can simply do &NODE_DATA(page_to_nid(page))->lru_lock Remove zone_lru_lock() function, since it's only complicate things. Use 'page_pgdat(page)->lru_lock' pattern instead. [[email protected]: a slightly better version of __split_huge_page()] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Andrey Ryabinin <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Acked-by: Mel Gorman <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Rik van Riel <[email protected]> Cc: William Kucharski <[email protected]> Cc: John Hubbard <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
a7ca12f9d9
commit
f4b7e272b5
13 changed files with 55 additions and 58 deletions
14
mm/mlock.c
14
mm/mlock.c
|
|
@ -182,7 +182,7 @@ static void __munlock_isolation_failed(struct page *page)
|
|||
unsigned int munlock_vma_page(struct page *page)
|
||||
{
|
||||
int nr_pages;
|
||||
struct zone *zone = page_zone(page);
|
||||
pg_data_t *pgdat = page_pgdat(page);
|
||||
|
||||
/* For try_to_munlock() and to serialize with page migration */
|
||||
BUG_ON(!PageLocked(page));
|
||||
|
|
@ -194,7 +194,7 @@ unsigned int munlock_vma_page(struct page *page)
|
|||
* might otherwise copy PageMlocked to part of the tail pages before
|
||||
* we clear it in the head page. It also stabilizes hpage_nr_pages().
|
||||
*/
|
||||
spin_lock_irq(zone_lru_lock(zone));
|
||||
spin_lock_irq(&pgdat->lru_lock);
|
||||
|
||||
if (!TestClearPageMlocked(page)) {
|
||||
/* Potentially, PTE-mapped THP: do not skip the rest PTEs */
|
||||
|
|
@ -203,17 +203,17 @@ unsigned int munlock_vma_page(struct page *page)
|
|||
}
|
||||
|
||||
nr_pages = hpage_nr_pages(page);
|
||||
__mod_zone_page_state(zone, NR_MLOCK, -nr_pages);
|
||||
__mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages);
|
||||
|
||||
if (__munlock_isolate_lru_page(page, true)) {
|
||||
spin_unlock_irq(zone_lru_lock(zone));
|
||||
spin_unlock_irq(&pgdat->lru_lock);
|
||||
__munlock_isolated_page(page);
|
||||
goto out;
|
||||
}
|
||||
__munlock_isolation_failed(page);
|
||||
|
||||
unlock_out:
|
||||
spin_unlock_irq(zone_lru_lock(zone));
|
||||
spin_unlock_irq(&pgdat->lru_lock);
|
||||
|
||||
out:
|
||||
return nr_pages - 1;
|
||||
|
|
@ -298,7 +298,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
|
|||
pagevec_init(&pvec_putback);
|
||||
|
||||
/* Phase 1: page isolation */
|
||||
spin_lock_irq(zone_lru_lock(zone));
|
||||
spin_lock_irq(&zone->zone_pgdat->lru_lock);
|
||||
for (i = 0; i < nr; i++) {
|
||||
struct page *page = pvec->pages[i];
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
|
|||
pvec->pages[i] = NULL;
|
||||
}
|
||||
__mod_zone_page_state(zone, NR_MLOCK, delta_munlocked);
|
||||
spin_unlock_irq(zone_lru_lock(zone));
|
||||
spin_unlock_irq(&zone->zone_pgdat->lru_lock);
|
||||
|
||||
/* Now we can release pins of pages that we are not munlocking */
|
||||
pagevec_release(&pvec_putback);
|
||||
|
|
|
|||
Loading…
Reference in a new issue