Add checks for kfree() of a page which was allocated with __alloc_pages(),
and for free_pages() of a page which was allocated with kmalloc().
#define PageSlab(page) test_bit(PG_slab, &(page)->flags)
#define SetPageSlab(page) set_bit(PG_slab, &(page)->flags)
#define ClearPageSlab(page) clear_bit(PG_slab, &(page)->flags)
+#define TestClearPageSlab(page) test_and_clear_bit(PG_slab, &(page)->flags)
+#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags)
#ifdef CONFIG_HIGHMEM
#define PageHighMem(page) test_bit(PG_highmem, &(page)->flags)
1 << PG_locked |
1 << PG_active |
1 << PG_reclaim |
+ 1 << PG_slab |
1 << PG_writeback )))
bad_page(function, page);
if (PageDirty(page))
* vm_scan(). Shouldn't be a worry.
*/
while (i--) {
- ClearPageSlab(page);
+ if (!TestClearPageSlab(page))
+ BUG();
page++;
}
sub_page_state(nr_slab, nr_freed);