From 470cce5085084b629e7ab801716502e9d7ada0a0 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Thu, 8 Jul 2021 11:12:29 -0700 Subject: [PATCH] ANDROID: mm: page_pinner: record every put_page There are some places using put_page_testzero instead of put_page. Thus, move page_pinner_put_page into put_page_testzero to catch all of put operations. Bug: 192475091 Signed-off-by: Minchan Kim Change-Id: If33b2a28ceb64e3ccab83990eac2c1cc291c3b08 --- include/linux/mm.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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