linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
To: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Mel Gorman <mel@csn.ul.ie>, Rik van Riel <riel@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Izik Eidus <ieidus@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Chris Wright <chrisw@redhat.com>, Nick Piggin <npiggin@suse.de>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/9] ksm: fix mlockfreed to munlocked
Date: Mon, 30 Nov 2009 16:27:01 -0500	[thread overview]
Message-ID: <1259616421.4663.205.camel@useless.americas.hpqcorp.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0911301200060.24660@sister.anvils>

On Mon, 2009-11-30 at 12:26 +0000, Hugh Dickins wrote:
> On Mon, 30 Nov 2009, KOSAKI Motohiro wrote:
> > > 
> > > But please clarify: that patch was for mmotm and hopefully 2.6.33,
> > > but the vmstat issue (minus warning message) is there in 2.6.32-rc.
> > > Should I
> > > 
> > > (a) forget it for 2.6.32
> > > (b) rush Linus a patch for 2.6.32 final
> > > (c) send a patch for 2.6.32.stable later on
> > 
> > I personally prefer (3). though I don't know ksm so detail.
> 
> Thanks, I think that would be my preference by now too.
> 
> > > There's a remark in munlock_vma_page(), apropos a different issue,
> > > 			/*
> > > 			 * We lost the race.  let try_to_unmap() deal
> > > 			 * with it.  At least we get the page state and
> > > 			 * mlock stats right.  However, page is still on
> > > 			 * the noreclaim list.  We'll fix that up when
> > > 			 * the page is eventually freed or we scan the
> > > 			 * noreclaim list.
> > > 			 */
> > > which implies that sometimes we scan the unevictable list and resolve
> > > such cases.  But I wonder if that's nowadays the case?
> > 
> > We don't scan unevictable list at all. munlock_vma_page() logic is.
> > 
> >   1) clear PG_mlock always anyway
> >   2) isolate page
> >   3) scan related vma and remark PG_mlock if necessary
> > 
> > So, as far as I understand, the above comment describe the case when (2) is
> > failed. it mean another task already isolated the page. it makes the task
> > putback the page to evictable list and vmscan's try_to_unmap() move 
> > the page to unevictable list again.
> 
> That is the case it's addressing, yes; but both references to
> "the noreclaim list" are untrue and misleading (now: they may well
> have been accurate when the comment went in).  I'd like to correct
> it, but cannot do so without spending the time to make sure that
> what I'm saying instead isn't equally misleading...
> 
> Even "We lost the race" is worrying: which race? there might be several.

I agree that this is likely a stale comment.  At the time I wrote it,
putback_lru_page() didn't recheck whether the page was reclaimable [now
"evictable"].  isolate_lru_page() preserves the lru state flags Active
and Unevictable; at that time putback' just put the page back to the
list indicated.  

"The race" referred to the "isolation race" discussed in the comment
block on munlock_vma_page().

Had we been munlock()ing or munmap()ing the last VMA holding the page
locked, we should take it off the unevictable list.  But, we need to
isolate the page to move it between lists or even to call
try_to_unlock() to check whether there are other vmas holding the page
mlocked.  If we were unable to isolate the page in munlock_vma_page()
and it were "putback" by whatever was holding it [page migration
maybe?], it would go back onto the unevictable list where it would be
stranded. 

Now that we recheck the page state in putback_lru_page(), this shouldn't
be an issue.  We've already cleared the Mlock page flag, so that
condition won't force it onto the unevictable list.

Even the part about try_to_unmap() dealing with it is stale.  Now,
vmscan detects VM_LOCKED pages in page_referenced() before it gets to
try_to_unmap().  The function comment block needs updating as well.  If
no one beats me to it, I'll post a cleanup patch for consideration
shortly.

Lee


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

--
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:[~2009-11-30 21:27 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24 16:37 [PATCH 0/9] ksm: swapping Hugh Dickins
2009-11-24 16:40 ` [PATCH 1/9] ksm: fix mlockfreed to munlocked Hugh Dickins
2009-11-24 23:53   ` Rik van Riel
2009-11-26 16:20   ` Mel Gorman
2009-11-27 12:45     ` Hugh Dickins
2009-11-30  6:01       ` KOSAKI Motohiro
2009-11-30 12:26         ` Hugh Dickins
2009-11-30 21:27           ` Lee Schermerhorn [this message]
2009-12-01 11:14       ` Mel Gorman
2009-11-24 16:42 ` [PATCH 2/9] ksm: let shared pages be swappable Hugh Dickins
2009-11-30  0:46   ` KAMEZAWA Hiroyuki
2009-11-30  9:15     ` KOSAKI Motohiro
2009-11-30 12:38       ` Hugh Dickins
2009-12-01  4:14         ` KOSAKI Motohiro
2009-11-30 11:55     ` Hugh Dickins
2009-11-30 12:07     ` Andrea Arcangeli
2009-12-01  0:39       ` KAMEZAWA Hiroyuki
2009-12-01  6:32         ` Chris Wright
2009-12-01  9:11         ` Andrea Arcangeli
2009-12-01  9:28           ` KOSAKI Motohiro
2009-12-01  9:37             ` Andrea Arcangeli
2009-12-01  9:46               ` KOSAKI Motohiro
2009-12-01  9:59                 ` Andrea Arcangeli
2009-12-02  5:08                   ` Rik van Riel
2009-12-02 12:55                     ` Andrea Arcangeli
2009-12-03  5:15                       ` KOSAKI Motohiro
2009-12-04  5:06                         ` KOSAKI Motohiro
2009-12-04  5:16                           ` KAMEZAWA Hiroyuki
2009-12-04 14:49                             ` Andrea Arcangeli
2009-12-04 17:16                             ` Chris Wright
2009-12-04 18:53                               ` Andrea Arcangeli
2009-12-04 19:03                                 ` Chris Wright
2009-12-09  0:43                               ` KAMEZAWA Hiroyuki
2009-12-09  1:04                                 ` Chris Wright
2009-12-09 16:12                                 ` Andrea Arcangeli
2009-12-09 23:54                                   ` KAMEZAWA Hiroyuki
2009-12-04 14:45                           ` Andrea Arcangeli
2009-12-04 16:21                             ` Rik van Riel
2009-11-24 16:43 ` [PATCH 3/9] ksm: hold anon_vma in rmap_item Hugh Dickins
2009-11-24 16:45 ` [PATCH 4/9] ksm: take keyhole reference to page Hugh Dickins
2009-11-24 16:48 ` [PATCH 5/9] ksm: share anon page without allocating Hugh Dickins
2009-11-30  0:04   ` KAMEZAWA Hiroyuki
2009-11-30 11:18     ` Hugh Dickins
2009-12-01  0:02       ` KAMEZAWA Hiroyuki
2009-11-24 16:51 ` [PATCH 6/9] ksm: mem cgroup charge swapin copy Hugh Dickins
2009-11-25 14:23   ` Balbir Singh
2009-11-25 17:12     ` Hugh Dickins
2009-11-25 17:36       ` Balbir Singh
2009-11-30  0:13   ` KAMEZAWA Hiroyuki
2009-11-30 11:40     ` Hugh Dickins
2009-11-24 16:54 ` [PATCH 7/9] ksm: rmap_walk to remove_migation_ptes Hugh Dickins
2009-11-24 16:56 ` [PATCH 8/9] ksm: memory hotremove migration only Hugh Dickins
2009-11-24 16:57 ` [PATCH 9/9] ksm: remove unswappable max_kernel_pages Hugh Dickins

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=1259616421.4663.205.camel@useless.americas.hpqcorp.net \
    --to=lee.schermerhorn@hp.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisw@redhat.com \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=ieidus@redhat.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=npiggin@suse.de \
    --cc=riel@redhat.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