Commit 51726b1222863852c46ca21ed0115b85d1edfd89
Committed by
Linus Torvalds
1 parent
6d91add09f
Exists in
master
and in
7 other branches
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>
Showing 3 changed files with 14 additions and 17 deletions Side-by-side Diff
mm/page_io.c
... | ... | @@ -125,8 +125,8 @@ |
125 | 125 | struct bio *bio; |
126 | 126 | int ret = 0; |
127 | 127 | |
128 | - BUG_ON(!PageLocked(page)); | |
129 | - BUG_ON(PageUptodate(page)); | |
128 | + VM_BUG_ON(!PageLocked(page)); | |
129 | + VM_BUG_ON(PageUptodate(page)); | |
130 | 130 | bio = get_swap_bio(GFP_KERNEL, page_private(page), page, |
131 | 131 | end_swap_bio_read); |
132 | 132 | if (bio == NULL) { |
mm/swap_state.c
... | ... | @@ -72,10 +72,10 @@ |
72 | 72 | { |
73 | 73 | int error; |
74 | 74 | |
75 | - BUG_ON(!PageLocked(page)); | |
76 | - BUG_ON(PageSwapCache(page)); | |
77 | - BUG_ON(PagePrivate(page)); | |
78 | - BUG_ON(!PageSwapBacked(page)); | |
75 | + VM_BUG_ON(!PageLocked(page)); | |
76 | + VM_BUG_ON(PageSwapCache(page)); | |
77 | + VM_BUG_ON(!PageSwapBacked(page)); | |
78 | + | |
79 | 79 | error = radix_tree_preload(gfp_mask); |
80 | 80 | if (!error) { |
81 | 81 | page_cache_get(page); |
... | ... | @@ -108,10 +108,9 @@ |
108 | 108 | */ |
109 | 109 | void __delete_from_swap_cache(struct page *page) |
110 | 110 | { |
111 | - BUG_ON(!PageLocked(page)); | |
112 | - BUG_ON(!PageSwapCache(page)); | |
113 | - BUG_ON(PageWriteback(page)); | |
114 | - BUG_ON(PagePrivate(page)); | |
111 | + VM_BUG_ON(!PageLocked(page)); | |
112 | + VM_BUG_ON(!PageSwapCache(page)); | |
113 | + VM_BUG_ON(PageWriteback(page)); | |
115 | 114 | |
116 | 115 | radix_tree_delete(&swapper_space.page_tree, page_private(page)); |
117 | 116 | set_page_private(page, 0); |
... | ... | @@ -134,8 +133,8 @@ |
134 | 133 | swp_entry_t entry; |
135 | 134 | int err; |
136 | 135 | |
137 | - BUG_ON(!PageLocked(page)); | |
138 | - BUG_ON(!PageUptodate(page)); | |
136 | + VM_BUG_ON(!PageLocked(page)); | |
137 | + VM_BUG_ON(!PageUptodate(page)); | |
139 | 138 | |
140 | 139 | for (;;) { |
141 | 140 | entry = get_swap_page(); |
mm/swapfile.c
... | ... | @@ -333,7 +333,7 @@ |
333 | 333 | { |
334 | 334 | int count; |
335 | 335 | |
336 | - BUG_ON(!PageLocked(page)); | |
336 | + VM_BUG_ON(!PageLocked(page)); | |
337 | 337 | count = page_mapcount(page); |
338 | 338 | if (count <= 1 && PageSwapCache(page)) |
339 | 339 | count += page_swapcount(page); |
... | ... | @@ -350,8 +350,7 @@ |
350 | 350 | struct swap_info_struct * p; |
351 | 351 | swp_entry_t entry; |
352 | 352 | |
353 | - BUG_ON(PagePrivate(page)); | |
354 | - BUG_ON(!PageLocked(page)); | |
353 | + VM_BUG_ON(!PageLocked(page)); | |
355 | 354 | |
356 | 355 | if (!PageSwapCache(page)) |
357 | 356 | return 0; |
... | ... | @@ -432,7 +431,6 @@ |
432 | 431 | if (page) { |
433 | 432 | int one_user; |
434 | 433 | |
435 | - BUG_ON(PagePrivate(page)); | |
436 | 434 | one_user = (page_count(page) == 2); |
437 | 435 | /* Only cache user (+us), or swap space full? Free it! */ |
438 | 436 | /* Also recheck PageSwapCache after page is locked (above) */ |
... | ... | @@ -1209,7 +1207,7 @@ |
1209 | 1207 | { |
1210 | 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 | 1212 | if (PageSwapCache(page)) { |
1215 | 1213 | swp_entry_t entry = { .val = page_private(page) }; |