All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Izik Eidus <ieidus@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	linux-mm@kvack.org, avi@redhat.com, chrisw@redhat.com,
	mtosatti@redhat.com, hugh@veritas.com,
	kamezawa.hiroyu@jp.fujitsu.com
Subject: Re: [PATCH 3/4] add replace_page(): change the page pte is pointing to.
Date: Wed, 15 Apr 2009 13:25:11 +0200	[thread overview]
Message-ID: <20090415112511.GH9809@random.random> (raw)
In-Reply-To: <20090414150925.58b464f7.akpm@linux-foundation.org>

On Tue, Apr 14, 2009 at 03:09:25PM -0700, Andrew Morton wrote:
> On Thu,  9 Apr 2009 06:58:40 +0300
> Izik Eidus <ieidus@redhat.com> wrote:
> 
> > replace_page() allow changing the mapping of pte from one physical page
> > into diffrent physical page.
> 
> At a high level, this is very similar to what page migration does.  Yet
> this implementation shares nothing with the page migration code.
> 
> Can this situation be improved?

This was discussed last time too. Basically the thing is that using
migration entry with its special page fault paths, for this looks a
bit of an overkill complexity and unnecessary dependency on the
migration code. All we need is to mark the pte readonly. replace_page
is a no brainer then. The brainer part is page_wrprotect
(page_wrprotect is like fork).

The data visibility in the final memcmp you mentioned in the other
mail is supposedly taken care of by page_wrprotect too. It already
does flush_cache_page for the virtual indexed and not physically
tagged caches. page_wrprotect has to also IPI all CPUs to nuke any not
wrprotected tlb entry. I don't think we need further smp memory
barriers when we're guaranteed all tlb entries are wrprotected in the
other cpus and an IPI and invlpg run in them, to be sure we read the
data stable during memcmp even if we read through the kernel
pagetables and the last userland write happened through userland ptes
before they become effective wrprotected by the IPI.

WARNING: multiple messages have this Message-ID (diff)
From: Andrea Arcangeli <aarcange@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Izik Eidus <ieidus@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	linux-mm@kvack.org, avi@redhat.com, chrisw@redhat.com,
	mtosatti@redhat.com, hugh@veritas.com,
	kamezawa.hiroyu@jp.fujitsu.com
Subject: Re: [PATCH 3/4] add replace_page(): change the page pte is pointing to.
Date: Wed, 15 Apr 2009 13:25:11 +0200	[thread overview]
Message-ID: <20090415112511.GH9809@random.random> (raw)
In-Reply-To: <20090414150925.58b464f7.akpm@linux-foundation.org>

On Tue, Apr 14, 2009 at 03:09:25PM -0700, Andrew Morton wrote:
> On Thu,  9 Apr 2009 06:58:40 +0300
> Izik Eidus <ieidus@redhat.com> wrote:
> 
> > replace_page() allow changing the mapping of pte from one physical page
> > into diffrent physical page.
> 
> At a high level, this is very similar to what page migration does.  Yet
> this implementation shares nothing with the page migration code.
> 
> Can this situation be improved?

This was discussed last time too. Basically the thing is that using
migration entry with its special page fault paths, for this looks a
bit of an overkill complexity and unnecessary dependency on the
migration code. All we need is to mark the pte readonly. replace_page
is a no brainer then. The brainer part is page_wrprotect
(page_wrprotect is like fork).

The data visibility in the final memcmp you mentioned in the other
mail is supposedly taken care of by page_wrprotect too. It already
does flush_cache_page for the virtual indexed and not physically
tagged caches. page_wrprotect has to also IPI all CPUs to nuke any not
wrprotected tlb entry. I don't think we need further smp memory
barriers when we're guaranteed all tlb entries are wrprotected in the
other cpus and an IPI and invlpg run in them, to be sure we read the
data stable during memcmp even if we read through the kernel
pagetables and the last userland write happened through userland ptes
before they become effective wrprotected by the IPI.

--
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-04-15 11:26 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09  3:58 [PATCH 0/4] ksm - dynamic page sharing driver for linux v3 Izik Eidus
2009-04-09  3:58 ` Izik Eidus
2009-04-09  3:58 ` [PATCH 1/4] MMU_NOTIFIERS: add set_pte_at_notify() Izik Eidus
2009-04-09  3:58   ` Izik Eidus
2009-04-09  3:58   ` [PATCH 2/4] add page_wrprotect(): write protecting page Izik Eidus
2009-04-09  3:58     ` Izik Eidus
2009-04-09  3:58     ` [PATCH 3/4] add replace_page(): change the page pte is pointing to Izik Eidus
2009-04-09  3:58       ` Izik Eidus
2009-04-09  3:58       ` [PATCH 4/4] add ksm kernel shared memory driver Izik Eidus
2009-04-09  3:58         ` Izik Eidus
2009-04-14 22:09         ` Andrew Morton
2009-04-14 22:09           ` Andrew Morton
2009-04-14 22:09           ` Andrew Morton
2009-04-15 22:37           ` Izik Eidus
2009-04-15 22:37             ` Izik Eidus
2009-04-15 22:50             ` Andrew Morton
2009-04-15 22:50               ` Andrew Morton
2009-04-15 23:21               ` Andrea Arcangeli
2009-04-15 23:21                 ` Andrea Arcangeli
2009-04-16  0:43           ` Jeremy Fitzhardinge
2009-04-16  0:43             ` Jeremy Fitzhardinge
2009-04-16  0:57             ` Izik Eidus
2009-04-16  0:57               ` Izik Eidus
2009-04-16 11:39             ` Andrea Arcangeli
2009-04-16 11:39               ` Andrea Arcangeli
2009-04-16 16:08               ` Jeremy Fitzhardinge
2009-04-16 16:08                 ` Jeremy Fitzhardinge
2009-04-18 14:58           ` Andrea Arcangeli
2009-04-18 14:58             ` Andrea Arcangeli
2009-04-14 22:09       ` [PATCH 3/4] add replace_page(): change the page pte is pointing to Andrew Morton
2009-04-14 22:09         ` Andrew Morton
2009-04-14 22:09         ` Andrew Morton
2009-04-15 11:25         ` Andrea Arcangeli [this message]
2009-04-15 11:25           ` Andrea Arcangeli
2009-04-15 22:48           ` Izik Eidus
2009-04-15 22:48             ` Izik Eidus
2009-04-14 22:09 ` [PATCH 0/4] ksm - dynamic page sharing driver for linux v3 Andrew Morton
2009-04-14 22:09   ` Andrew Morton
2009-04-14 22:09   ` Andrew Morton
2009-04-16 17:55   ` Nick Piggin
2009-04-16 17:55     ` Nick Piggin
2009-04-16 18:25     ` Izik Eidus
2009-04-16 18:25       ` Izik Eidus
2009-04-17  7:08     ` Jared Hulbert
2009-04-17  7:08       ` Jared Hulbert
2009-04-21  2:59       ` Nick Piggin
2009-04-21  2:59         ` Nick Piggin
  -- strict thread matches above, loose matches on Subject: below --
2009-04-04 14:35 [PATCH 0/4] ksm - dynamic page sharing driver for linux v2 Izik Eidus
2009-04-04 14:35 ` [PATCH 1/4] MMU_NOTIFIERS: add set_pte_at_notify() Izik Eidus
2009-04-04 14:35   ` [PATCH 2/4] add page_wrprotect(): write protecting page Izik Eidus
2009-04-04 14:35     ` [PATCH 3/4] add replace_page(): change the page pte is pointing to Izik Eidus
2009-04-04 14:35       ` Izik Eidus
2009-03-30 23:59 [PATCH 0/4] ksm - dynamic page sharing driver for linux Izik Eidus
2009-03-30 23:59 ` [PATCH 1/4] MMU_NOTIFIERS: add set_pte_at_notify() Izik Eidus
2009-03-30 23:59   ` [PATCH 2/4] add page_wrprotect(): write protecting page Izik Eidus
2009-03-30 23:59     ` [PATCH 3/4] add replace_page(): change the page pte is pointing to Izik Eidus
2009-03-30 23:59       ` Izik Eidus

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=20090415112511.GH9809@random.random \
    --to=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=avi@redhat.com \
    --cc=chrisw@redhat.com \
    --cc=hugh@veritas.com \
    --cc=ieidus@redhat.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtosatti@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 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.