linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Sasha Levin <sasha.levin@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: joern@logfs.org, mgorman@suse.de,
	Michel Lespinasse <walken@google.com>,
	riel@redhat.com, LKML <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: kernel BUG in munlock_vma_pages_range
Date: Wed, 11 Dec 2013 23:59:04 +0100	[thread overview]
Message-ID: <52A8EE38.2060004@suse.cz> (raw)
In-Reply-To: <52A6275F.4040007@oracle.com>

On 12/09/2013 09:26 PM, Sasha Levin wrote:
> On 12/09/2013 12:12 PM, Vlastimil Babka wrote:
>> On 12/09/2013 06:05 PM, Sasha Levin wrote:
>>> On 12/09/2013 04:34 AM, Vlastimil Babka wrote:
>>>> Hello, I will look at it, thanks.
>>>> Do you have specific reproduction instructions?
>>>
>>> Not really, the fuzzer hit it once and I've been unable to trigger it again. Looking at
>>> the piece of code involved it might have had something to do with hugetlbfs, so I'll crank
>>> up testing on that part.
>>
>> Thanks. Do you have trinity log and the .config file? I'm currently unable to even boot linux-next
>> with my config/setup due to a GPF.
>> Looking at code I wouldn't expect that it could encounter a tail page, without first encountering a
>> head page and skipping the whole huge page. At least in THP case, as TLB pages should be split when
>> a vma is split. As for hugetlbfs, it should be skipped for mlock/munlock operations completely. One
>> of these assumptions is probably failing here...
> 
> If it helps, I've added a dump_page() in case we hit a tail page there and got:
> 
> [  980.172299] page:ffffea003e5e8040 count:0 mapcount:1 mapping:          (null) index:0
> x0
> [  980.173412] page flags: 0x2fffff80008000(tail)
> 
> I can also add anything else in there to get other debug output if you think of something else useful.

Please try the following. Thanks in advance.

------8<------
diff --git a/mm/mlock.c b/mm/mlock.c
index d480cd6..c81b7c3 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -436,11 +436,14 @@ static unsigned long __munlock_pagevec_fill(struct pagevec *pvec,
 void munlock_vma_pages_range(struct vm_area_struct *vma,
 			     unsigned long start, unsigned long end)
 {
+	unsigned long orig_start = start;
+	unsigned int page_increm = 0;
+
 	vma->vm_flags &= ~VM_LOCKED;

 	while (start < end) {
 		struct page *page = NULL;
-		unsigned int page_mask, page_increm;
+		unsigned int page_mask;
 		struct pagevec pvec;
 		struct zone *zone;
 		int zoneid;
@@ -457,6 +460,22 @@ void munlock_vma_pages_range(struct vm_area_struct *vma,
 				&page_mask);

 		if (page && !IS_ERR(page)) {
+			if (PageTail(page)) {
+				struct page *first_page;
+				dump_page(page);
+				printk("start=%lu pfn=%lu orig_start=%lu "
+				       "page_increm=%d "
+				       "vm_start=%lu vm_end=%lu vm_flags=%lu\n",
+					start, page_to_pfn(page), orig_start,
+					page_increm,
+					vma->vm_start, vma->vm_end,
+					vma->vm_flags);
+				first_page = page->first_page;
+				printk("first_page pfn=%lu\n",
+						page_to_pfn(first_page));
+				dump_page(first_page);
+				VM_BUG_ON(true);
+			}
 			if (PageTransHuge(page)) {
 				lock_page(page);
 				/*


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-12-11 22:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-08  1:52 kernel BUG in munlock_vma_pages_range Sasha Levin
2013-12-09  9:34 ` Vlastimil Babka
2013-12-09 17:05   ` Sasha Levin
2013-12-09 17:12     ` Vlastimil Babka
2013-12-09 17:15       ` Sasha Levin
2013-12-09 20:26       ` Sasha Levin
2013-12-11 22:59         ` Vlastimil Babka [this message]
2013-12-12  3:16           ` Sasha Levin
2013-12-12  5:03             ` Bob Liu
2013-12-12 12:41               ` Vlastimil Babka
2013-12-12 21:05                 ` Sasha Levin
2013-12-13  8:49                   ` Bob Liu
2013-12-13  9:08                     ` Vlastimil Babka
2013-12-15 19:49                       ` Sasha Levin
2013-12-16 10:14                         ` [PATCH 0/3] Fix bugs in munlock Vlastimil Babka
2013-12-16 10:14                           ` [PATCH 1/3] mm: munlock: fix a bug where THP tail page is encountered Vlastimil Babka
2013-12-17  1:26                             ` Bob Liu
2013-12-17 13:00                               ` Vlastimil Babka
2013-12-18  0:48                                 ` Bob Liu
2014-03-14 23:55                                 ` Sasha Levin
2014-03-15  3:06                                   ` Sasha Levin
2014-03-17 12:38                                     ` Vlastimil Babka
2014-03-17 21:08                                       ` Sasha Levin
2014-03-17 22:20                                         ` Vlastimil Babka
2014-03-17 22:58                                           ` Sasha Levin
2014-03-17 23:30                                             ` Vlastimil Babka
2014-03-18 10:41                                             ` Vlastimil Babka
2013-12-16 10:14                           ` [PATCH 2/3] mm: munlock: fix deadlock in __munlock_pagevec() Vlastimil Babka
2013-12-17  0:31                             ` Andrew Morton
2013-12-17 13:08                               ` Vlastimil Babka
2013-12-16 10:14                           ` [RFC PATCH 3/3] mm: munlock: fix potential race with THP page split Vlastimil Babka
2014-03-21  1:53                       ` kernel BUG in munlock_vma_pages_range Sasha Levin
2014-03-21  9:02                         ` Vlastimil Babka
2013-12-09 21:16     ` Jiri Kosina
2013-12-11 15:55       ` Sasha Levin

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=52A8EE38.2060004@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=riel@redhat.com \
    --cc=sasha.levin@oracle.com \
    --cc=walken@google.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 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).