All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Laura Abbott <labbott@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [REGRESSION] !PageLocked(page) assertion with tcpdump
Date: Wed, 10 Aug 2016 19:13:45 +0300	[thread overview]
Message-ID: <20160810161345.GA67522@black.fi.intel.com> (raw)
In-Reply-To: <c711e067-0bff-a6cb-3c37-04dfe77d2db1@redhat.com>

On Wed, Aug 10, 2016 at 07:33:38AM -0700, Laura Abbott wrote:
> Hi,
> 
> There have been several reports[1] of assertions tripping when using
> tcpdump on the latest master:
> 
> [ 1013.718212] device wlp2s0 entered promiscuous mode
> [ 1013.736003] page:ffffea0004380000 count:2 mapcount:0 mapping:
> (null) index:0x0 compound_mapcount: 0
> [ 1013.736013] flags: 0x17ffffc0004000(head)
> [ 1013.736017] page dumped because: VM_BUG_ON_PAGE(!PageLocked(page))
> [ 1013.736044] ------------[ cut here ]------------
> [ 1013.736091] kernel BUG at mm/rmap.c:1288!

The patch below should do the trick.

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Laura Abbott <labbott@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [REGRESSION] !PageLocked(page) assertion with tcpdump
Date: Wed, 10 Aug 2016 19:13:45 +0300	[thread overview]
Message-ID: <20160810161345.GA67522@black.fi.intel.com> (raw)
In-Reply-To: <c711e067-0bff-a6cb-3c37-04dfe77d2db1@redhat.com>

On Wed, Aug 10, 2016 at 07:33:38AM -0700, Laura Abbott wrote:
> Hi,
> 
> There have been several reports[1] of assertions tripping when using
> tcpdump on the latest master:
> 
> [ 1013.718212] device wlp2s0 entered promiscuous mode
> [ 1013.736003] page:ffffea0004380000 count:2 mapcount:0 mapping:
> (null) index:0x0 compound_mapcount: 0
> [ 1013.736013] flags: 0x17ffffc0004000(head)
> [ 1013.736017] page dumped because: VM_BUG_ON_PAGE(!PageLocked(page))
> [ 1013.736044] ------------[ cut here ]------------
> [ 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

  reply	other threads:[~2016-08-10 16:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 14:33 [REGRESSION] !PageLocked(page) assertion with tcpdump Laura Abbott
2016-08-10 14:33 ` Laura Abbott
2016-08-10 16:13 ` Kirill A. Shutemov [this message]
2016-08-10 16:13   ` Kirill A. Shutemov
2016-08-10 20:03   ` Laura Abbott
2016-08-10 20:03     ` Laura Abbott

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=20160810161345.GA67522@black.fi.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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.