Commit 55308a20 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] more slab page checking

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().
parent 6571a956
......@@ -191,6 +191,8 @@ extern void get_full_page_state(struct page_state *ret);
#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)
......
......@@ -220,6 +220,7 @@ static inline void free_pages_check(const char *function, struct page *page)
1 << PG_locked |
1 << PG_active |
1 << PG_reclaim |
1 << PG_slab |
1 << PG_writeback )))
bad_page(function, page);
if (PageDirty(page))
......
......@@ -787,7 +787,8 @@ static inline void kmem_freepages (kmem_cache_t *cachep, void *addr)
* vm_scan(). Shouldn't be a worry.
*/
while (i--) {
ClearPageSlab(page);
if (!TestClearPageSlab(page))
BUG();
page++;
}
sub_page_state(nr_slab, nr_freed);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment