mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
[PATCH] mm: VM_BUG_ON
Introduce a VM_BUG_ON, which is turned on with CONFIG_DEBUG_VM. Use this in the lightweight, inline refcounting functions; PageLRU and PageActive checks in vmscan, because they're pretty well confined to vmscan. And in page allocate/free fastpaths which can be the hottest parts of the kernel for kbuilds. Unlike BUG_ON, VM_BUG_ON must not be used to execute statements with side-effects, and should not be used outside core mm code. Signed-off-by: Nick Piggin <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
a6ca1b99ed
commit
725d704eca
5 changed files with 36 additions and 29 deletions
12
mm/swap.c
12
mm/swap.c
|
|
@ -233,7 +233,7 @@ void fastcall __page_cache_release(struct page *page)
|
|||
struct zone *zone = page_zone(page);
|
||||
|
||||
spin_lock_irqsave(&zone->lru_lock, flags);
|
||||
BUG_ON(!PageLRU(page));
|
||||
VM_BUG_ON(!PageLRU(page));
|
||||
__ClearPageLRU(page);
|
||||
del_page_from_lru(zone, page);
|
||||
spin_unlock_irqrestore(&zone->lru_lock, flags);
|
||||
|
|
@ -284,7 +284,7 @@ void release_pages(struct page **pages, int nr, int cold)
|
|||
zone = pagezone;
|
||||
spin_lock_irq(&zone->lru_lock);
|
||||
}
|
||||
BUG_ON(!PageLRU(page));
|
||||
VM_BUG_ON(!PageLRU(page));
|
||||
__ClearPageLRU(page);
|
||||
del_page_from_lru(zone, page);
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ void __pagevec_release_nonlru(struct pagevec *pvec)
|
|||
for (i = 0; i < pagevec_count(pvec); i++) {
|
||||
struct page *page = pvec->pages[i];
|
||||
|
||||
BUG_ON(PageLRU(page));
|
||||
VM_BUG_ON(PageLRU(page));
|
||||
if (put_page_testzero(page))
|
||||
pagevec_add(&pages_to_free, page);
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@ void __pagevec_lru_add(struct pagevec *pvec)
|
|||
zone = pagezone;
|
||||
spin_lock_irq(&zone->lru_lock);
|
||||
}
|
||||
BUG_ON(PageLRU(page));
|
||||
VM_BUG_ON(PageLRU(page));
|
||||
SetPageLRU(page);
|
||||
add_page_to_inactive_list(zone, page);
|
||||
}
|
||||
|
|
@ -391,9 +391,9 @@ void __pagevec_lru_add_active(struct pagevec *pvec)
|
|||
zone = pagezone;
|
||||
spin_lock_irq(&zone->lru_lock);
|
||||
}
|
||||
BUG_ON(PageLRU(page));
|
||||
VM_BUG_ON(PageLRU(page));
|
||||
SetPageLRU(page);
|
||||
BUG_ON(PageActive(page));
|
||||
VM_BUG_ON(PageActive(page));
|
||||
SetPageActive(page);
|
||||
add_page_to_active_list(zone, page);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue