diff options
author | Hugh Dickins <hugh@veritas.com> | 2009-01-06 17:39:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 18:59:02 -0500 |
commit | 51726b1222863852c46ca21ed0115b85d1edfd89 (patch) | |
tree | fb9d4de47a1ee860003bc4aa7c46651a77ae7b83 | |
parent | 6d91add09f4bad5f4d4233b13faa392f0c4b16be (diff) |
mm: replace some BUG_ONs by VM_BUG_ONs
The swap code is over-provisioned with BUG_ONs on assorted page flags,
mostly dating back to 2.3. They're good documentation, and guard against
developer error, but a waste of space on most systems: change them to
VM_BUG_ONs, conditional on CONFIG_DEBUG_VM. Just delete the PagePrivate
ones: they're later, from 2.5.69, but even less interesting now.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/page_io.c | 4 | ||||
-rw-r--r-- | mm/swap_state.c | 19 | ||||
-rw-r--r-- | mm/swapfile.c | 8 |
3 files changed, 14 insertions, 17 deletions
diff --git a/mm/page_io.c b/mm/page_io.c index 065c4480eaf0..d277a80efa71 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -125,8 +125,8 @@ int swap_readpage(struct file *file, struct page *page) | |||
125 | struct bio *bio; | 125 | struct bio *bio; |
126 | int ret = 0; | 126 | int ret = 0; |
127 | 127 | ||
128 | BUG_ON(!PageLocked(page)); | 128 | VM_BUG_ON(!PageLocked(page)); |
129 | BUG_ON(PageUptodate(page)); | 129 | VM_BUG_ON(PageUptodate(page)); |
130 | bio = get_swap_bio(GFP_KERNEL, page_private(page), page, | 130 | bio = get_swap_bio(GFP_KERNEL, page_private(page), page, |
131 | end_swap_bio_read); | 131 | end_swap_bio_read); |
132 | if (bio == NULL) { | 132 | if (bio == NULL) { |
diff --git a/mm/swap_state.c b/mm/swap_state.c index 3353c9029cef..e793fdea275d 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
@@ -72,10 +72,10 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask) | |||
72 | { | 72 | { |
73 | int error; | 73 | int error; |
74 | 74 | ||
75 | BUG_ON(!PageLocked(page)); | 75 | VM_BUG_ON(!PageLocked(page)); |
76 | BUG_ON(PageSwapCache(page)); | 76 | VM_BUG_ON(PageSwapCache(page)); |
77 | BUG_ON(PagePrivate(page)); | 77 | VM_BUG_ON(!PageSwapBacked(page)); |
78 | BUG_ON(!PageSwapBacked(page)); | 78 | |
79 | error = radix_tree_preload(gfp_mask); | 79 | error = radix_tree_preload(gfp_mask); |
80 | if (!error) { | 80 | if (!error) { |
81 | page_cache_get(page); | 81 | page_cache_get(page); |
@@ -108,10 +108,9 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask) | |||
108 | */ | 108 | */ |
109 | void __delete_from_swap_cache(struct page *page) | 109 | void __delete_from_swap_cache(struct page *page) |
110 | { | 110 | { |
111 | BUG_ON(!PageLocked(page)); | 111 | VM_BUG_ON(!PageLocked(page)); |
112 | BUG_ON(!PageSwapCache(page)); | 112 | VM_BUG_ON(!PageSwapCache(page)); |
113 | BUG_ON(PageWriteback(page)); | 113 | VM_BUG_ON(PageWriteback(page)); |
114 | BUG_ON(PagePrivate(page)); | ||
115 | 114 | ||
116 | radix_tree_delete(&swapper_space.page_tree, page_private(page)); | 115 | radix_tree_delete(&swapper_space.page_tree, page_private(page)); |
117 | set_page_private(page, 0); | 116 | set_page_private(page, 0); |
@@ -134,8 +133,8 @@ int add_to_swap(struct page * page, gfp_t gfp_mask) | |||
134 | swp_entry_t entry; | 133 | swp_entry_t entry; |
135 | int err; | 134 | int err; |
136 | 135 | ||
137 | BUG_ON(!PageLocked(page)); | 136 | VM_BUG_ON(!PageLocked(page)); |
138 | BUG_ON(!PageUptodate(page)); | 137 | VM_BUG_ON(!PageUptodate(page)); |
139 | 138 | ||
140 | for (;;) { | 139 | for (;;) { |
141 | entry = get_swap_page(); | 140 | entry = get_swap_page(); |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 54a9f87e5162..214e90b94946 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -333,7 +333,7 @@ int can_share_swap_page(struct page *page) | |||
333 | { | 333 | { |
334 | int count; | 334 | int count; |
335 | 335 | ||
336 | BUG_ON(!PageLocked(page)); | 336 | VM_BUG_ON(!PageLocked(page)); |
337 | count = page_mapcount(page); | 337 | count = page_mapcount(page); |
338 | if (count <= 1 && PageSwapCache(page)) | 338 | if (count <= 1 && PageSwapCache(page)) |
339 | count += page_swapcount(page); | 339 | count += page_swapcount(page); |
@@ -350,8 +350,7 @@ static int remove_exclusive_swap_page_count(struct page *page, int count) | |||
350 | struct swap_info_struct * p; | 350 | struct swap_info_struct * p; |
351 | swp_entry_t entry; | 351 | swp_entry_t entry; |
352 | 352 | ||
353 | BUG_ON(PagePrivate(page)); | 353 | VM_BUG_ON(!PageLocked(page)); |
354 | BUG_ON(!PageLocked(page)); | ||
355 | 354 | ||
356 | if (!PageSwapCache(page)) | 355 | if (!PageSwapCache(page)) |
357 | return 0; | 356 | return 0; |
@@ -432,7 +431,6 @@ void free_swap_and_cache(swp_entry_t entry) | |||
432 | if (page) { | 431 | if (page) { |
433 | int one_user; | 432 | int one_user; |
434 | 433 | ||
435 | BUG_ON(PagePrivate(page)); | ||
436 | one_user = (page_count(page) == 2); | 434 | one_user = (page_count(page) == 2); |
437 | /* Only cache user (+us), or swap space full? Free it! */ | 435 | /* Only cache user (+us), or swap space full? Free it! */ |
438 | /* Also recheck PageSwapCache after page is locked (above) */ | 436 | /* Also recheck PageSwapCache after page is locked (above) */ |
@@ -1209,7 +1207,7 @@ int page_queue_congested(struct page *page) | |||
1209 | { | 1207 | { |
1210 | struct backing_dev_info *bdi; | 1208 | struct backing_dev_info *bdi; |
1211 | 1209 | ||
1212 | BUG_ON(!PageLocked(page)); /* It pins the swap_info_struct */ | 1210 | VM_BUG_ON(!PageLocked(page)); /* It pins the swap_info_struct */ |
1213 | 1211 | ||
1214 | if (PageSwapCache(page)) { | 1212 | if (PageSwapCache(page)) { |
1215 | swp_entry_t entry = { .val = page_private(page) }; | 1213 | swp_entry_t entry = { .val = page_private(page) }; |