Commit c99b0372 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] debug check in put_page_testzero()

As suggested by Daniel - it's a bug to run put_page_testzero
against a zero-ref page.
parent cdf2f98b
......@@ -195,7 +195,11 @@ struct page {
*/
#define get_page(p) atomic_inc(&(p)->count)
#define __put_page(p) atomic_dec(&(p)->count)
#define put_page_testzero(p) atomic_dec_and_test(&(p)->count)
#define put_page_testzero(p) \
({ \
BUG_ON(page_count(page) == 0); \
atomic_dec_and_test(&(p)->count); \
})
#define page_count(p) atomic_read(&(p)->count)
#define set_page_count(p,v) atomic_set(&(p)->count, v)
extern void FASTCALL(__page_cache_release(struct page *));
......
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