diff mbox series

[2/2] mm/memory: put refcount of normal page in zap_pte_range()

Message ID 1587267017-25310-2-git-send-email-qiwuchen55@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() | expand

Commit Message

chenqiwu April 19, 2020, 3:30 a.m. UTC
From: chenqiwu <chenqiwu@xiaomi.com>

As discussed in patch[1], there is an imbalnace of normal
page refcount between copy_one_pte() and zap_pte_range().
This patch put the refcount of normal page back in
zap_pte_range() to fix the imbalance.

[1] https://patchwork.kernel.org/patch/11494691/

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 mm/memory.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Matthew Wilcox April 19, 2020, 10:30 a.m. UTC | #1
On Sun, Apr 19, 2020 at 11:30:17AM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> As discussed in patch[1], there is an imbalnace of normal
> page refcount between copy_one_pte() and zap_pte_range().
> This patch put the refcount of normal page back in
> zap_pte_range() to fix the imbalance.

I think you misunderstood the discussion.  NAK.  Did you test this?
diff mbox series

Patch

diff --git a/mm/memory.c b/mm/memory.c
index 2143827..ec8de9a 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1088,6 +1088,7 @@  static unsigned long zap_pte_range(struct mmu_gather *tlb,
 			}
 			rss[mm_counter(page)]--;
 			page_remove_rmap(page, false);
+			put_page(page);
 			if (unlikely(page_mapcount(page) < 0))
 				print_bad_pte(vma, addr, ptent, page);
 			if (unlikely(__tlb_remove_page(tlb, page))) {