All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20160810161345.GA67522@black.fi.intel.com>

diff --git a/a/1.txt b/N1/1.txt
index b5c41c5..6f47d92 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -13,3 +13,46 @@ On Wed, Aug 10, 2016 at 07:33:38AM -0700, Laura Abbott wrote:
 > [ 1013.736091] kernel BUG at mm/rmap.c:1288!
 
 The patch below should do the trick.
+
+>From 8026e3a2cecb7cdd3a63ebc266fb359ef7ec965b Mon Sep 17 00:00:00 2001
+From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Date: Wed, 10 Aug 2016 18:51:54 +0300
+Subject: [PATCH] mm, rmap: fix false positive VM_BUG() in page_add_file_rmap()
+
+PageTransCompound() doesn't distinguish THP from from any other type of
+compound pages. This can lead to false-positive VM_BUG_ON() in
+page_add_file_rmap() if called on compound page from a driver[1].
+
+I think we can exclude such cases by checking if the page belong to a
+mapping.
+
+The VM_BUG_ON_PAGE() is downgraded to VM_WARN_ON_ONCE(). This path
+should not cause any harm to non-THP page, but good to know if we step
+on anything else.
+
+[1] http://lkml.kernel.org/r/c711e067-0bff-a6cb-3c37-04dfe77d2db1@redhat.com
+
+Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Reported-by: Laura Abbott <labbott@redhat.com>
+---
+ mm/rmap.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/mm/rmap.c b/mm/rmap.c
+index eee844997bd8..f071d6f7a986 100644
+--- a/mm/rmap.c
++++ b/mm/rmap.c
+@@ -1286,8 +1286,9 @@ void page_add_file_rmap(struct page *page, bool compound)
+ 		else
+ 			__inc_node_page_state(page, NR_FILE_PMDMAPPED);
+ 	} else {
+-		if (PageTransCompound(page)) {
+-			VM_BUG_ON_PAGE(!PageLocked(page), page);
++		if (PageTransCompound(page) && page_mapping(page)) {
++			VM_WARN_ON_ONCE(!PageLocked(page));
++
+ 			SetPageDoubleMap(compound_head(page));
+ 			if (PageMlocked(page))
+ 				clear_page_mlock(compound_head(page));
+-- 
+ Kirill A. Shutemov
diff --git a/a/content_digest b/N1/content_digest
index 9c3b6ff..12bb848 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -22,6 +22,49 @@
  "> [ 1013.736044] ------------[ cut here ]------------\n"
  "> [ 1013.736091] kernel BUG at mm/rmap.c:1288!\n"
  "\n"
- The patch below should do the trick.
+ "The patch below should do the trick.\n"
+ "\n"
+ ">From 8026e3a2cecb7cdd3a63ebc266fb359ef7ec965b Mon Sep 17 00:00:00 2001\n"
+ "From: \"Kirill A. Shutemov\" <kirill.shutemov@linux.intel.com>\n"
+ "Date: Wed, 10 Aug 2016 18:51:54 +0300\n"
+ "Subject: [PATCH] mm, rmap: fix false positive VM_BUG() in page_add_file_rmap()\n"
+ "\n"
+ "PageTransCompound() doesn't distinguish THP from from any other type of\n"
+ "compound pages. This can lead to false-positive VM_BUG_ON() in\n"
+ "page_add_file_rmap() if called on compound page from a driver[1].\n"
+ "\n"
+ "I think we can exclude such cases by checking if the page belong to a\n"
+ "mapping.\n"
+ "\n"
+ "The VM_BUG_ON_PAGE() is downgraded to VM_WARN_ON_ONCE(). This path\n"
+ "should not cause any harm to non-THP page, but good to know if we step\n"
+ "on anything else.\n"
+ "\n"
+ "[1] http://lkml.kernel.org/r/c711e067-0bff-a6cb-3c37-04dfe77d2db1@redhat.com\n"
+ "\n"
+ "Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\n"
+ "Reported-by: Laura Abbott <labbott@redhat.com>\n"
+ "---\n"
+ " mm/rmap.c | 5 +++--\n"
+ " 1 file changed, 3 insertions(+), 2 deletions(-)\n"
+ "\n"
+ "diff --git a/mm/rmap.c b/mm/rmap.c\n"
+ "index eee844997bd8..f071d6f7a986 100644\n"
+ "--- a/mm/rmap.c\n"
+ "+++ b/mm/rmap.c\n"
+ "@@ -1286,8 +1286,9 @@ void page_add_file_rmap(struct page *page, bool compound)\n"
+ " \t\telse\n"
+ " \t\t\t__inc_node_page_state(page, NR_FILE_PMDMAPPED);\n"
+ " \t} else {\n"
+ "-\t\tif (PageTransCompound(page)) {\n"
+ "-\t\t\tVM_BUG_ON_PAGE(!PageLocked(page), page);\n"
+ "+\t\tif (PageTransCompound(page) && page_mapping(page)) {\n"
+ "+\t\t\tVM_WARN_ON_ONCE(!PageLocked(page));\n"
+ "+\n"
+ " \t\t\tSetPageDoubleMap(compound_head(page));\n"
+ " \t\t\tif (PageMlocked(page))\n"
+ " \t\t\t\tclear_page_mlock(compound_head(page));\n"
+ "-- \n"
+  Kirill A. Shutemov
 
-fce2b5d5d49d5a70231b15805abda53b9df2f5ea4e2ce02f7fe953d7307a9e9c
+33af7827ff8c20f064baf3f2bd1fd300561be286354429fd77e5a0dc7274544e

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.