mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Daniel J Blueman" <daniel.blueman@gmail.com>
To: "Zoltan Menyhart" <Zoltan.Menyhart@bull.net>
Cc: "Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: copy_one_pte()
Date: Wed, 16 May 2007 14:09:59 +0100	[thread overview]
Message-ID: <6278d2220705160609x5c8462b6i25935a449352bf12@mail.gmail.com> (raw)
In-Reply-To: <461209BE.6010905@bull.net>

On 03/04/07, Zoltan Menyhart <Zoltan.Menyhart@bull.net> wrote:
> Daniel J Blueman wrote:
> > On 13 Mar, 20:20, Zoltan Menyhart <Zoltan.Menyh...@free.fr> wrote:
> >
> >> I had a look at copy_one_pte().
> >> I cannot see any ioproc_update_page() call, not even for the COW pages.
> >> Is it intentional?
> >
> > There could be an ioproc_update_range() call in
> > memory.c:copy_pte_range(), after the pte_unmap_unlock(), and this
> > would be an optimisation, since explicitly updating the mappings in
> > the Quadrics RDMA NIC avoids the need for the NIC to trap and update
> > it's MMU later.
>
> I can agree that this optimization is a good idea.
>
> Can you please confirm that cp->update_range() understands the concept of
> the COW? (I.e. the card should not write anything into the COW pages.)
>
> > The code which implements [1] this takes the pagetable locks with
> > pte_offset_map_lock(), and uses one of the kmap_atomic slots, so has
> > to be after the pagetables are unlocked. The
> > ioproc_invalidate_page/range() calls are different and can't live with
> > this race, so have to be used with the pagetable locks held.
>
> I can see two issues here:
>
> - Performance problem: page_table_lock is more expensive than a split lock,
>   and taking page_table_lock after the split lock released is even worse.

I have introduced an ioproc_update_page_locked() call for this and
related paths, and updated the kernel patches; this avoids a race
condition I was seeing in multi-threaded processes taking concurrent
page faults under the split locks. The split lock is now acquired
once, and the changes allowed me to do other some optimisations on
this path too.

> - Synchronization problem: do_wp_page() is protected by the appropriate
>   split lock, i.e. the COW page can be broken up while you are inside
>   cp->update_range() under the protection of page_table_lock.

The split locks were used previously via pte_offset_map_lock(), so
this race wasn't possible previously.

> I think the PTE modification and the cp->update_xxx() should be protected
> by the very same lock, without releasing it between the two operations.
> I think the PTE modification and the cp->update_xxx() should be an
> atomic operation with respect to the VMM activity.

This does make most sense and is now the case, although atomiticity
wasn't a problem, since it's fine to use ioproc_update_page/range()
speculatively.

Dan

> Thanks,
>
> Zoltan
-- 
Daniel J Blueman

  parent reply	other threads:[~2007-05-16 13:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-02 16:17 copy_one_pte() Daniel J Blueman
     [not found] ` <461209BE.6010905@bull.net>
2007-05-16 13:09   ` Daniel J Blueman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-03-13 19:15 copy_one_pte() Zoltan Menyhart
2007-03-13 19:18 ` copy_one_pte() Christoph Hellwig
2007-03-14  8:35   ` copy_one_pte() Matt Keenan
2007-03-15 19:06     ` copy_one_pte() Andrew Morton
2007-03-15 19:51       ` copy_one_pte() Matt Keenan

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=6278d2220705160609x5c8462b6i25935a449352bf12@mail.gmail.com \
    --to=daniel.blueman@gmail.com \
    --cc=Zoltan.Menyhart@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    /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®