linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memory: add refcount for special mapping page in copy_one_pte()
@ 2020-04-17 10:31 qiwuchen55
  2020-04-17 11:43 ` Michal Hocko
  0 siblings, 1 reply; 7+ messages in thread
From: qiwuchen55 @ 2020-04-17 10:31 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, chenqiwu

From: chenqiwu <chenqiwu@xiaomi.com>

If we get a special mapping page like device mapping page or zero page
when copy_one_pte, it's necessary add the page refcount count.

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

diff --git a/mm/memory.c b/mm/memory.c
index f703fe8..a57975a 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -802,8 +802,9 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
 		get_page(page);
 		page_dup_rmap(page, false);
 		rss[mm_counter(page)]++;
-	} else if (pte_devmap(pte)) {
+	} else if (pte_devmap(pte) || is_zero_pfn(pte_pfn(pte))) {
 		page = pte_page(pte);
+		get_page(page);
 	}
 
 out_set_pte:
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-20  7:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 10:31 [PATCH] mm/memory: add refcount for special mapping page in copy_one_pte() qiwuchen55
2020-04-17 11:43 ` Michal Hocko
2020-04-17 14:26   ` chenqiwu
2020-04-17 14:45     ` Matthew Wilcox
2020-04-17 15:23     ` Michal Hocko
2020-04-18  3:12       ` chenqiwu
2020-04-20  7:42         ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).