[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTim6ATGxTiMcfK5-03azgcWuT4wtJA@mail.gmail.com>
Date: Tue, 12 Apr 2011 10:19:57 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Robert Święcki <robert@...ecki.net>
Cc: Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Miklos Szeredi <miklos@...redi.hu>,
Michel Lespinasse <walken@...gle.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH] mm: fix possible cause of a page_mapped BUG
On Tue, Apr 12, 2011 at 8:48 AM, Robert Święcki <robert@...ecki.net> wrote:
>>
>> Hmm. Sounds like an endless loop in kernel mode.
>>
>> Use "perf record -ag" as root, it should show up very clearly in the report.
>
> I've put some data here -
> http://groups.google.com/group/fa.linux.kernel/browse_thread/thread/4345dcc4f7750ce2
> - I think it's somewhat connected (sys_mlock appears on both cases).
Ok, so it's definitely sys_mlock.
And I suspect it's due to commit 53a7706d5ed8 somehow looping forever.
One possible cause would be how that commit made things care deeply
about the return value of __get_user_pages(), and in particular what
happens when that return value is zero. It ends up looping forever in
do_mlock_pages() for that case, because it does
nend = nstart + ret * PAGE_SIZE;
so now the next round we'll set "nstart = nend" and start all over.
I see at least one way __get_user_pages() will return zero, and it's
if it is passed a npages of 0 to begin with. Which can easily happen
if you try to mlock() the first page of a stack segment: the code will
jump over that stack segment page, and then have nothing to do, and
return zero. So then do_mlock_pages() will just keep on trying again.
THIS IS A HACKY AND UNTESTED PATCH!
It's ugly as hell, because the real problem is do_mlock_pages() caring
too damn much about the return value, and us hiding the whole stack
page thing in that function. I wouldn't want to commit it as-is, but
if you can easily reproduce the problem, it's a good patch to test out
the theory. Assuming I didn't screw something up.
Again, TOTALLY UNTESTED!
Linus
View attachment "patch.diff" of type "text/x-patch" (1066 bytes)
Powered by blists - more mailing lists