All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: v4.6 kernel BUG at mm/rmap.c:1101!
Date: Mon, 23 May 2016 17:08:26 +0200	[thread overview]
Message-ID: <20160523150826.GA20829@redhat.com> (raw)
In-Reply-To: <20160523140638.GA1738@lahna.fi.intel.com>

On Mon, May 23, 2016 at 05:06:38PM +0300, Mika Westerberg wrote:
> Hi,
> 
> After upgrading kernel of my desktop system from v4.6-rc7 to v4.6, I've
> started seeing following:
> 
> [176611.093747] page:ffffea0000360000 count:1 mapcount:0 mapping:ffff880034d2e0a1 index:0x1f9b06600 compound_mapcount: 0
> [176611.093751] flags: 0x3fff8000044079(locked|uptodate|dirty|lru|active|head|swapbacked)
> [176611.093752] page dumped because: VM_BUG_ON_PAGE(page->index != linear_page_index(vma, address))
> [176611.093753] page->mem_cgroup:ffff88049e81b800
> [176611.093765] ------------[ cut here ]------------

This is a splitted pmd tail that is triggering a COW, but it's still a
compound page because the physical split didn't happen yet.

So like Kirill correctly pointed out, in such case we've to do
compound_head because the page->mapping that has to be refiled to the
local anon_vma is in the head.

It's just a false positive VM_BUG_ON, the code itself is correct.

Production kernels should be built with CONFIG_DEBUG_VM=n so this is
not going to affect them and there's no bug for the production builds.

Can you test this to shut off the false positive?

>From 4db87e3e44837a0b038e58eaa3fea29db84723ec Mon Sep 17 00:00:00 2001
From: Andrea Arcangeli <aarcange@redhat.com>
Date: Mon, 23 May 2016 17:03:57 +0200
Subject: [PATCH 1/1] mm: thp: avoid false positive VM_BUG_ON_PAGE in
 page_move_anon_rmap()

If the page_move_anon_rmap() is refiling a pmd-splitted THP mapped in
a tail page from a pte, the "address" must be THP aligned in order for
the page->index bugcheck to pass in the CONFIG_DEBUG_VM=y builds.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
 mm/rmap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 8a83993..e2e47ba9 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1098,7 +1098,10 @@ void page_move_anon_rmap(struct page *page,
 
 	VM_BUG_ON_PAGE(!PageLocked(page), page);
 	VM_BUG_ON_VMA(!anon_vma, vma);
-	VM_BUG_ON_PAGE(page->index != linear_page_index(vma, address), page);
+	VM_BUG_ON_PAGE(page->index !=
+		       linear_page_index(vma, PageTransHuge(page) ?
+					 address & HPAGE_PMD_MASK :
+					 address), page);
 
 	anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
 	/*

  parent reply	other threads:[~2016-05-23 15:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 14:06 v4.6 kernel BUG at mm/rmap.c:1101! Mika Westerberg
2016-05-23 14:24 ` Kirill A. Shutemov
2016-05-23 15:18   ` Andrea Arcangeli
2016-05-25  9:47     ` Mika Westerberg
2016-05-23 15:08 ` Andrea Arcangeli [this message]
2016-05-24  8:12   ` Mika Westerberg
2016-05-24 14:08     ` Andrea Arcangeli
2016-05-24 14:53       ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160523150826.GA20829@redhat.com \
    --to=aarcange@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.