[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1483721203-1678-2-git-send-email-jglisse@redhat.com>
Date: Fri, 6 Jan 2017 11:46:28 -0500
From: Jérôme Glisse <jglisse@...hat.com>
To: akpm@...ux-foundation.org, <linux-kernel@...r.kernel.org>,
linux-mm@...ck.org
Cc: John Hubbard <jhubbard@...dia.com>,
Jérôme Glisse <jglisse@...hat.com>,
Dan Williams <dan.j.williams@...el.com>,
Ross Zwisler <ross.zwisler@...ux.intel.com>
Subject: [HMM v15 01/16] mm/free_hot_cold_page: catch ZONE_DEVICE pages
Catch page from ZONE_DEVICE in free_hot_cold_page(). This should never
happen as ZONE_DEVICE page must always have an elevated refcount.
This is safety-net to catch any refcounting issues in a sane way for any
ZONE_DEVICE pages.
Signed-off-by: Jérôme Glisse <jglisse@...hat.com>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Ross Zwisler <ross.zwisler@...ux.intel.com>
---
mm/page_alloc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1c24112..355beb4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2445,6 +2445,16 @@ void free_hot_cold_page(struct page *page, bool cold)
unsigned long pfn = page_to_pfn(page);
int migratetype;
+ /*
+ * This should never happen ! Page from ZONE_DEVICE always must have an
+ * active refcount. Complain about it and try to restore the refcount.
+ */
+ if (is_zone_device_page(page)) {
+ VM_BUG_ON_PAGE(is_zone_device_page(page), page);
+ page_ref_inc(page);
+ return;
+ }
+
if (!free_pcp_prepare(page))
return;
--
2.4.3
Powered by blists - more mailing lists