summaryrefslogtreecommitdiff
path: root/include/linux/mm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c68771c27d88..5cef04a2623e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -232,11 +232,15 @@ static inline void get_page(struct page *page)
static inline void put_page(struct page *page)
{
if (PageCompound(page)) {
- page = (struct page *)page->lru.next;
- if (page->lru.prev) { /* destructor? */
- (*(void (*)(struct page *))page->lru.prev)(page);
- return;
+ if (put_page_testzero(page)) {
+ page = (struct page *)page->lru.next;
+ if (page->lru.prev) { /* destructor? */
+ (*(void (*)(struct page *))page->lru.prev)(page);
+ } else {
+ __page_cache_release(page);
+ }
}
+ return;
}
if (!PageReserved(page) && put_page_testzero(page))
__page_cache_release(page);