diff options
author | Nick Piggin <npiggin@suse.de> | 2006-09-26 02:30:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:44 -0400 |
commit | 725d704ecaca4a43f067092c140d4f3271cf2856 (patch) | |
tree | 320cf8ab5457ac6c01c05da8c30d6026538ee259 /mm/vmscan.c | |
parent | a6ca1b99ed434f3fb41bbed647ed36c0420501e5 (diff) |
[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 <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Christoph Lameter <clameter@engr.sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 5d4c4d02254d..41a3da3d6ccc 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -440,7 +440,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
440 | if (TestSetPageLocked(page)) | 440 | if (TestSetPageLocked(page)) |
441 | goto keep; | 441 | goto keep; |
442 | 442 | ||
443 | BUG_ON(PageActive(page)); | 443 | VM_BUG_ON(PageActive(page)); |
444 | 444 | ||
445 | sc->nr_scanned++; | 445 | sc->nr_scanned++; |
446 | 446 | ||
@@ -564,7 +564,7 @@ keep_locked: | |||
564 | unlock_page(page); | 564 | unlock_page(page); |
565 | keep: | 565 | keep: |
566 | list_add(&page->lru, &ret_pages); | 566 | list_add(&page->lru, &ret_pages); |
567 | BUG_ON(PageLRU(page)); | 567 | VM_BUG_ON(PageLRU(page)); |
568 | } | 568 | } |
569 | list_splice(&ret_pages, page_list); | 569 | list_splice(&ret_pages, page_list); |
570 | if (pagevec_count(&freed_pvec)) | 570 | if (pagevec_count(&freed_pvec)) |
@@ -603,7 +603,7 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan, | |||
603 | page = lru_to_page(src); | 603 | page = lru_to_page(src); |
604 | prefetchw_prev_lru_page(page, src, flags); | 604 | prefetchw_prev_lru_page(page, src, flags); |
605 | 605 | ||
606 | BUG_ON(!PageLRU(page)); | 606 | VM_BUG_ON(!PageLRU(page)); |
607 | 607 | ||
608 | list_del(&page->lru); | 608 | list_del(&page->lru); |
609 | target = src; | 609 | target = src; |
@@ -674,7 +674,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan, | |||
674 | */ | 674 | */ |
675 | while (!list_empty(&page_list)) { | 675 | while (!list_empty(&page_list)) { |
676 | page = lru_to_page(&page_list); | 676 | page = lru_to_page(&page_list); |
677 | BUG_ON(PageLRU(page)); | 677 | VM_BUG_ON(PageLRU(page)); |
678 | SetPageLRU(page); | 678 | SetPageLRU(page); |
679 | list_del(&page->lru); | 679 | list_del(&page->lru); |
680 | if (PageActive(page)) | 680 | if (PageActive(page)) |
@@ -797,9 +797,9 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
797 | while (!list_empty(&l_inactive)) { | 797 | while (!list_empty(&l_inactive)) { |
798 | page = lru_to_page(&l_inactive); | 798 | page = lru_to_page(&l_inactive); |
799 | prefetchw_prev_lru_page(page, &l_inactive, flags); | 799 | prefetchw_prev_lru_page(page, &l_inactive, flags); |
800 | BUG_ON(PageLRU(page)); | 800 | VM_BUG_ON(PageLRU(page)); |
801 | SetPageLRU(page); | 801 | SetPageLRU(page); |
802 | BUG_ON(!PageActive(page)); | 802 | VM_BUG_ON(!PageActive(page)); |
803 | ClearPageActive(page); | 803 | ClearPageActive(page); |
804 | 804 | ||
805 | list_move(&page->lru, &zone->inactive_list); | 805 | list_move(&page->lru, &zone->inactive_list); |
@@ -827,9 +827,9 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
827 | while (!list_empty(&l_active)) { | 827 | while (!list_empty(&l_active)) { |
828 | page = lru_to_page(&l_active); | 828 | page = lru_to_page(&l_active); |
829 | prefetchw_prev_lru_page(page, &l_active, flags); | 829 | prefetchw_prev_lru_page(page, &l_active, flags); |
830 | BUG_ON(PageLRU(page)); | 830 | VM_BUG_ON(PageLRU(page)); |
831 | SetPageLRU(page); | 831 | SetPageLRU(page); |
832 | BUG_ON(!PageActive(page)); | 832 | VM_BUG_ON(!PageActive(page)); |
833 | list_move(&page->lru, &zone->active_list); | 833 | list_move(&page->lru, &zone->active_list); |
834 | pgmoved++; | 834 | pgmoved++; |
835 | if (!pagevec_add(&pvec, page)) { | 835 | if (!pagevec_add(&pvec, page)) { |