All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Michel Lespinasse <walken@google.com>,
	Bob Liu <bob.liu@oracle.com>,
	npiggin@suse.de, kosaki.motohiro@jp.fujitsu.com, riel@redhat.com,
	David Rientjes <rientjes@google.com>,
	Mel Gorman <mgorman@suse.de>, Minchan Kim <minchan@kernel.org>,
	Hugh Dickins <hughd@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] mm/mlock: fix BUG_ON unlocked page for nolinear VMAs
Date: Fri, 03 Jan 2014 15:17:16 -0500	[thread overview]
Message-ID: <52C71ACC.20603@oracle.com> (raw)
In-Reply-To: <20131218134316.977d5049209d9278e1dad225@linux-foundation.org>

On 12/18/2013 04:43 PM, Andrew Morton wrote:
> On Wed, 18 Dec 2013 17:23:03 +0800 Wanpeng Li <liwanp@linux.vnet.ibm.com> wrote:
>
>>>> diff --git a/mm/rmap.c b/mm/rmap.c
>>>> index 55c8b8d..1e24813 100644
>>>> --- a/mm/rmap.c
>>>> +++ b/mm/rmap.c
>>>> @@ -1347,6 +1347,7 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
>>>>   	unsigned long end;
>>>>   	int ret = SWAP_AGAIN;
>>>>   	int locked_vma = 0;
>>>> +	int we_locked = 0;
>>>>
>>>>   	address = (vma->vm_start + cursor) & CLUSTER_MASK;
>>>>   	end = address + CLUSTER_SIZE;
>>>> @@ -1385,9 +1386,15 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
>>>>   		BUG_ON(!page || PageAnon(page));
>>>>
>>>>   		if (locked_vma) {
>>>> -			mlock_vma_page(page);   /* no-op if already mlocked */
>>>> -			if (page == check_page)
>>>> +			if (page != check_page) {
>>>> +				we_locked = trylock_page(page);
>>>
>>> If it's not us who has the page already locked, but somebody else, he
>>> might unlock it at this point and then the BUG_ON in mlock_vma_page()
>>> will trigger again.
>
> yes, this patch is pretty weak.
>
>> Any better idea is appreciated. ;-)
>
> Remove the BUG_ON() from mlock_vma_page()?  Why was it added?
> isolate_lru_page() and putback_lru_page() and *might* require
> the page be locked, but I don't immediately see issues?

Ping? This BUG() is triggerable in 3.13-rc6 right now.


Thanks,
Sasha

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

WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sasha.levin@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Michel Lespinasse <walken@google.com>,
	Bob Liu <bob.liu@oracle.com>,
	npiggin@suse.de, kosaki.motohiro@jp.fujitsu.com, riel@redhat.com,
	David Rientjes <rientjes@google.com>,
	Mel Gorman <mgorman@suse.de>, Minchan Kim <minchan@kernel.org>,
	Hugh Dickins <hughd@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] mm/mlock: fix BUG_ON unlocked page for nolinear VMAs
Date: Fri, 03 Jan 2014 15:17:16 -0500	[thread overview]
Message-ID: <52C71ACC.20603@oracle.com> (raw)
In-Reply-To: <20131218134316.977d5049209d9278e1dad225@linux-foundation.org>

On 12/18/2013 04:43 PM, Andrew Morton wrote:
> On Wed, 18 Dec 2013 17:23:03 +0800 Wanpeng Li <liwanp@linux.vnet.ibm.com> wrote:
>
>>>> diff --git a/mm/rmap.c b/mm/rmap.c
>>>> index 55c8b8d..1e24813 100644
>>>> --- a/mm/rmap.c
>>>> +++ b/mm/rmap.c
>>>> @@ -1347,6 +1347,7 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
>>>>   	unsigned long end;
>>>>   	int ret = SWAP_AGAIN;
>>>>   	int locked_vma = 0;
>>>> +	int we_locked = 0;
>>>>
>>>>   	address = (vma->vm_start + cursor) & CLUSTER_MASK;
>>>>   	end = address + CLUSTER_SIZE;
>>>> @@ -1385,9 +1386,15 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
>>>>   		BUG_ON(!page || PageAnon(page));
>>>>
>>>>   		if (locked_vma) {
>>>> -			mlock_vma_page(page);   /* no-op if already mlocked */
>>>> -			if (page == check_page)
>>>> +			if (page != check_page) {
>>>> +				we_locked = trylock_page(page);
>>>
>>> If it's not us who has the page already locked, but somebody else, he
>>> might unlock it at this point and then the BUG_ON in mlock_vma_page()
>>> will trigger again.
>
> yes, this patch is pretty weak.
>
>> Any better idea is appreciated. ;-)
>
> Remove the BUG_ON() from mlock_vma_page()?  Why was it added?
> isolate_lru_page() and putback_lru_page() and *might* require
> the page be locked, but I don't immediately see issues?

Ping? This BUG() is triggerable in 3.13-rc6 right now.


Thanks,
Sasha


  reply	other threads:[~2014-01-03 20:17 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  8:05 [PATCH] mm/mlock: fix BUG_ON unlocked page for nolinear VMAs Wanpeng Li
2013-12-17  8:05 ` Wanpeng Li
2013-12-18  3:14 ` Wanpeng Li
2013-12-18  3:16 ` Wanpeng Li
2013-12-18  3:23   ` Wanpeng Li
     [not found]   ` <20131218032329.GA6044@hacker.(null)>
2013-12-18  3:32     ` Sasha Levin
2013-12-18  3:32       ` Sasha Levin
2013-12-18  4:12       ` Wanpeng Li
2013-12-18  9:11         ` Vlastimil Babka
2013-12-18  9:11           ` Vlastimil Babka
2013-12-18  9:23           ` Wanpeng Li
     [not found]           ` <52b1699f.87293c0a.75d1.34d3SMTPIN_ADDED_BROKEN@mx.google.com>
2013-12-18 21:43             ` Andrew Morton
2013-12-18 21:43               ` Andrew Morton
2014-01-03 20:17               ` Sasha Levin [this message]
2014-01-03 20:17                 ` Sasha Levin
2014-01-03 20:52                 ` Linus Torvalds
2014-01-03 20:52                   ` Linus Torvalds
2014-01-03 23:36                   ` Vlastimil Babka
2014-01-03 23:36                     ` Vlastimil Babka
2014-01-03 23:56                     ` Andrew Morton
2014-01-03 23:56                       ` Andrew Morton
2014-01-04  3:03                       ` Sasha Levin
2014-01-04  3:03                         ` Sasha Levin
2014-01-04  0:18                     ` Linus Torvalds
2014-01-04  0:18                       ` Linus Torvalds
2014-01-04  8:09                       ` Vlastimil Babka
2014-01-04  8:09                         ` Vlastimil Babka
2014-01-05  0:27                       ` Wanpeng Li
2014-01-06 16:47                       ` Motohiro Kosaki
2014-01-06 16:47                         ` Motohiro Kosaki
2014-01-06 22:01                         ` KOSAKI Motohiro
2014-01-06 22:01                           ` KOSAKI Motohiro
2014-01-07  5:27                         ` Wanpeng Li
2014-01-07 15:01                         ` Vlastimil Babka
2014-01-07 15:01                           ` Vlastimil Babka
2014-01-08  1:06                           ` Bob Liu
2014-01-08  1:06                             ` Bob Liu
2014-01-08  2:44                           ` Linus Torvalds
2014-01-08  2:44                             ` Linus Torvalds
2014-01-10 17:48                           ` Motohiro Kosaki
2014-01-10 17:48                             ` Motohiro Kosaki
2014-01-13 14:03                             ` Vlastimil Babka
2014-01-13 14:03                               ` Vlastimil Babka
2014-01-14 11:05                               ` Vlastimil Babka
2014-01-14 11:05                                 ` Vlastimil Babka
2014-01-04  3:31                   ` Bob Liu
2014-01-04  3:31                     ` Bob Liu
2013-12-18  8:54 ` Vlastimil Babka
2013-12-18  8:54   ` Vlastimil Babka
2013-12-18  9:01   ` Wanpeng Li

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=52C71ACC.20603@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bob.liu@oracle.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liwanp@linux.vnet.ibm.com \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=npiggin@suse.de \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    --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 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.