mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Sasha Levin <sasha.levin@oracle.com>,
	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
Subject: Re: [PATCH] mm/mlock: fix BUG_ON unlocked page for nolinear VMAs
Date: Wed, 18 Dec 2013 13:43:16 -0800	[thread overview]
Message-ID: <20131218134316.977d5049209d9278e1dad225@linux-foundation.org> (raw)
In-Reply-To: <52b1699f.87293c0a.75d1.34d3SMTPIN_ADDED_BROKEN@mx.google.com>

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?

  parent reply	other threads:[~2013-12-18 21:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  8:05 Wanpeng Li
     [not found] ` <52b1138b.0201430a.19a8.605dSMTPIN_ADDED_BROKEN@mx.google.com>
     [not found]   ` <20131218032329.GA6044@hacker.(null)>
2013-12-18  3:32     ` Sasha Levin
     [not found]       ` <52b120a5.a3b2440a.3acf.ffffd7c3SMTPIN_ADDED_BROKEN@mx.google.com>
2013-12-18  9:11         ` Vlastimil Babka
     [not found]           ` <52b1699f.87293c0a.75d1.34d3SMTPIN_ADDED_BROKEN@mx.google.com>
2013-12-18 21:43             ` Andrew Morton [this message]
2014-01-03 20:17               ` Sasha Levin
2014-01-03 20:52                 ` Linus Torvalds
2014-01-03 23:36                   ` Vlastimil Babka
2014-01-03 23:56                     ` Andrew Morton
2014-01-04  3:03                       ` Sasha Levin
2014-01-04  0:18                     ` Linus Torvalds
2014-01-04  8:09                       ` Vlastimil Babka
2014-01-06 16:47                       ` Motohiro Kosaki
2014-01-06 22:01                         ` KOSAKI Motohiro
2014-01-07 15:01                         ` Vlastimil Babka
2014-01-08  1:06                           ` Bob Liu
2014-01-08  2:44                           ` Linus Torvalds
2014-01-10 17:48                           ` Motohiro Kosaki
2014-01-13 14:03                             ` Vlastimil Babka
2014-01-14 11:05                               ` Vlastimil Babka
2014-01-04  3:31                   ` Bob Liu
2013-12-18  8:54 ` Vlastimil Babka

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=20131218134316.977d5049209d9278e1dad225@linux-foundation.org \
    --to=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=sasha.levin@oracle.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®