mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap.patch added to -mm tree
@ 2016-08-10 21:54 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2016-08-10 21:54 UTC (permalink / raw)
  To: kirill.shutemov, labbott, mm-commits


The patch titled
     Subject: mm, rmap: fix false positive VM_BUG() in page_add_file_rmap()
has been added to the -mm tree.  Its filename is
     mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: 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

Link: http://lkml.kernel.org/r/20160810161345.GA67522@black.fi.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Laura Abbott <labbott@redhat.com>
Tested-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/rmap.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN mm/rmap.c~mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap mm/rmap.c
--- a/mm/rmap.c~mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap
+++ a/mm/rmap.c
@@ -1284,8 +1284,9 @@ void page_add_file_rmap(struct page *pag
 		VM_BUG_ON_PAGE(!PageSwapBacked(page), page);
 		__inc_node_page_state(page, NR_SHMEM_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));
_

Patches currently in -mm which might be from kirill.shutemov@linux.intel.com are

mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-10 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 21:54 + mm-rmap-fix-false-positive-vm_bug-in-page_add_file_rmap.patch added to -mm tree akpm

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).