aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 224178a000d2..7d20b25c58fc 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -278,6 +278,12 @@ struct page {
278 */ 278 */
279#include <linux/page-flags.h> 279#include <linux/page-flags.h>
280 280
281#ifdef CONFIG_DEBUG_VM
282#define VM_BUG_ON(cond) BUG_ON(cond)
283#else
284#define VM_BUG_ON(condition) do { } while(0)
285#endif
286
281/* 287/*
282 * Methods to modify the page usage count. 288 * Methods to modify the page usage count.
283 * 289 *
@@ -297,7 +303,7 @@ struct page {
297 */ 303 */
298static inline int put_page_testzero(struct page *page) 304static inline int put_page_testzero(struct page *page)
299{ 305{
300 BUG_ON(atomic_read(&page->_count) == 0); 306 VM_BUG_ON(atomic_read(&page->_count) == 0);
301 return atomic_dec_and_test(&page->_count); 307 return atomic_dec_and_test(&page->_count);
302} 308}
303 309
@@ -307,6 +313,7 @@ static inline int put_page_testzero(struct page *page)
307 */ 313 */
308static inline int get_page_unless_zero(struct page *page) 314static inline int get_page_unless_zero(struct page *page)
309{ 315{
316 VM_BUG_ON(PageCompound(page));
310 return atomic_inc_not_zero(&page->_count); 317 return atomic_inc_not_zero(&page->_count);
311} 318}
312 319
@@ -323,6 +330,7 @@ static inline void get_page(struct page *page)
323{ 330{
324 if (unlikely(PageCompound(page))) 331 if (unlikely(PageCompound(page)))
325 page = (struct page *)page_private(page); 332 page = (struct page *)page_private(page);
333 VM_BUG_ON(atomic_read(&page->_count) == 0);
326 atomic_inc(&page->_count); 334 atomic_inc(&page->_count);
327} 335}
328 336