diff --git a/include/linux/mm.h b/include/linux/mm.h index c776fc2bcf8d..4f3e9a10e387 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -756,8 +756,13 @@ struct inode; */ static inline int put_page_testzero(struct page *page) { + int ret; + VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); - return page_ref_dec_and_test(page); + ret = page_ref_dec_and_test(page); + page_pinner_put_page(page); + + return ret; } /* @@ -1233,8 +1238,6 @@ static inline void put_page(struct page *page) { page = compound_head(page); - page_pinner_put_page(page); - /* * For devmap managed pages we need to catch refcount transition from * 2 to 1, when refcount reach one it means the page is free and we