linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-mm@kvack.org, lee.schermerhorn@hp.com,
	lhms-devel@lists.sourceforge.net, taka@valinux.co.jp,
	marcelo.tosatti@cyclades.com
Subject: Re: [RFC 5/6] Swapless V1: Rip out swap migration code
Date: Tue, 4 Apr 2006 20:47:58 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0604042038370.31431@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20060405123341.52145bf5.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, 5 Apr 2006, KAMEZAWA Hiroyuki wrote:

> On Tue, 4 Apr 2006 19:45:49 -0700 (PDT)
> Christoph Lameter <clameter@sgi.com> wrote:
> 
> > > My concern is refcnt handling of SWP_TYPE_MIGRATION pages, but maybe no problem.
> > 
> > What are the exact concerns?
> > 
> When a page is converted into SWP_TYPE_MIGRATION, changed pte entry
> implicitly points old page. This introduces the state 'a page is referred 
> but no refcnt'. if mmap_sem is held, this is maybe no problem. 
> but looks a bit dangerous.

We have increased the refcnt on the page (see isolate_lru_page()) and the 
page is locked when  SWP_TYPE_MIGRATION is used. So there is a refcnt.

> > > I think adding SWP_TYPE_MIGRATION consideration to free_swap_and_cache() is
> > > enough against anon_vma vanishing. Because remove_migration_ptes() compares 
> > > old pte entry with old page's pfn, a page cannot be remapped into old place
> > > when anon_vma has gone. This is my first impression.
> > 
> > However, the last process containing the page may terminate and free the 
> > page, while we migrate. The SWAP_TYPE_MIGRATION pte will be rewoved 
> > together with the anonvma if no lock is held on mmap_sem. 
> yes. 
> 
> > Then remove_migration_ptes() cannot obtain a anon_vma. So it would break 
> > without holding mmap_sem. We could fix this if we could somehow know that 
> > the last process mapping the page vanished and skip 
> > remove_migration_ptes().
> > 
> 
> Hmm, I'm not sure but how about this way ?
> 1. don't drop refcnt in try_to_unmap_one() when changing a page to 
>    SWP_TYPE_MIGRATION. because it is referred. (rmap should be removed ?)

Then we would have a page with mapcounts but there are no real ptes 
pointing to the page. It would be a strange condition for the page. 

Moreover, a process may fork or terminate while we migrate. Forking may 
increase the refcnt and termination may decrease it. We do not keep
refcnts for the SWP_TYPE_MIGRATION entry but rely on the reverse maps. So 
we may end up with a messed up mapcount if we do not drop the refcnts.

--
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:[~2006-04-05  3:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-04  6:57 [RFC 0/6] Swapless Page Migration V1: Overview Christoph Lameter
2006-04-04  6:57 ` [RFC 1/6] Swapless V1: try_to_unmap() - Rename ignrefs to "migration" Christoph Lameter
2006-04-04  6:57 ` [RFC 2/6] Swapless V1: Add SWP_TYPE_MIGRATION Christoph Lameter
2006-04-04 11:04   ` KAMEZAWA Hiroyuki
2006-04-04  6:57 ` [RFC 3/6] Swapless V1: try_to_unmap() - Create migration entries Christoph Lameter
2006-04-04  6:58 ` [RFC 4/6] Swapless V1: remove migration ptes Christoph Lameter
2006-04-04  6:58 ` [RFC 5/6] Swapless V1: Rip out swap migration code Christoph Lameter
2006-04-04 10:37   ` KAMEZAWA Hiroyuki
2006-04-04 15:06     ` Christoph Lameter
2006-04-05  1:06       ` KAMEZAWA Hiroyuki
2006-04-05  2:45         ` Christoph Lameter
2006-04-05  3:33           ` KAMEZAWA Hiroyuki
2006-04-05  3:47             ` Christoph Lameter [this message]
2006-04-05  4:07               ` KAMEZAWA Hiroyuki
2006-04-04  6:58 ` [RFC 6/6] Swapless V1: Revise main migration logic Christoph Lameter
2006-04-04 10:58   ` KAMEZAWA Hiroyuki
2006-04-04 14:24     ` Christoph Lameter
2006-04-05 14:46 ` [Lhms-devel] [RFC 0/6] Swapless Page Migration V1: Overview Lee Schermerhorn
2006-04-05 16:28   ` Christoph Lameter
2006-04-05 16:58     ` Lee Schermerhorn
2006-04-05 17:43       ` Christoph Lameter
2006-04-05 18:52         ` Lee Schermerhorn
2006-04-05 18:17       ` Some ideas on lazy migration with swapless migration Christoph Lameter

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=Pine.LNX.4.64.0604042038370.31431@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=lhms-devel@lists.sourceforge.net \
    --cc=linux-mm@kvack.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=taka@valinux.co.jp \
    /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