linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Nick Piggin <npiggin@suse.de>
Cc: linux-mm@kvack.org, Christoph Lameter <clameter@engr.sgi.com>,
	"Paul E. McKenney" <paulmck@us.ibm.com>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC][PATCH 3/5] mm: RCUify vma lookup
Date: Tue, 06 Mar 2007 13:31:49 +0100	[thread overview]
Message-ID: <1173184309.6374.110.camel@twins> (raw)
In-Reply-To: <20070306022319.GF23845@wotan.suse.de>

On Tue, 2007-03-06 at 03:23 +0100, Nick Piggin wrote:
> On Tue, Mar 06, 2007 at 02:38:18AM +0100, Peter Zijlstra wrote:

> > +static void lock_vma(struct vm_area_struct *vma)
> > +{
> > +	wait_event(vma->vm_mm->mm_wq, (atomic_cmpxchg(&vma->vm_count, 1, 0) == 1));
> > +}
> > +
> > +static void unlock_vma(struct vm_area_struct *vma)
> > +{
> > +	BUG_ON(atomic_read(&vma->vm_count));
> > +	atomic_set(&vma->vm_count, 1);
> > +}
> 
> This is a funny scheme you're trying to do in order to try to avoid
> rwsems. Of course it is subject to writer starvation, so please just
> use an rwsem per vma for this.

[damn, he spotted it :-)]

Yeah, I know :-(

> If the -rt tree cannot do them properly, then it just has to turn them
> into mutexes and take the hit itself.

That is, unfortunately, still not acceptable. Take futexes for example,
many threads 1 vma.

> There is no benefit for the -rt tree to do this anyway, because you're
> just re-introducing the fundamental problem that it has with rwsems
> anyway (ie. poor priority inheritance).

The thing is, we cannot make the whole VM realtime, that is just plain
impossible. What we do try to do is to carve a niche where RT operation
is possible. Like a preallocated mlocked arena. So mmap and all the
other vma modifiers would fall outside, but faults and futexes would
need to be inside the RT scope.

Ingo, any ideas? perhaps just introduce a raw rwlock in -rt and somehow
warn whenever an rt_task does a write lock?

Full vma RCUification is hindered by the serialisation requirements; one
cannot have two inconsistent views of the mm.

> In this case I guess you still need some sort of refcount in order to force
> the lookup into the slowpath, but please don't use it for locking.

down_read_trylock on the vma rw lock would work I guess.

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

  parent reply	other threads:[~2007-03-06 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06  1:38 [RFC][PATCH 0/5] Lockless vma lookups Peter Zijlstra
2007-03-06  1:38 ` [RFC][PATCH 1/5] RCU friendly B+tree Peter Zijlstra
2007-03-06  1:38 ` [RFC][PATCH 2/5] mm: use B+tree for vmas Peter Zijlstra
2007-03-06  1:38 ` [RFC][PATCH 3/5] mm: RCUify vma lookup Peter Zijlstra
2007-03-06  2:23   ` Nick Piggin
2007-03-06  8:36     ` Nick Piggin
2007-03-08 17:31       ` Ingo Molnar
2007-03-06 12:31     ` Peter Zijlstra [this message]
2007-03-06 12:35       ` Peter Zijlstra
2007-03-06  1:38 ` [RFC][PATCH 4/5] i386: lockless fault handler Peter Zijlstra
2007-03-06  1:38 ` [RFC][PATCH 5/5] x86_64: " Peter Zijlstra

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=1173184309.6374.110.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=clameter@engr.sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=paulmck@us.ibm.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