All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Daniel McNeil <daniel@osdl.org>
Cc: Andrew Morton <akpm@digeo.com>,
	dmccr@us.ibm.com, mika.penttila@kolumbus.fi, linux-mm@kvack.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Race between vmtruncate and mapped areas?
Date: Sat, 17 May 2003 19:29:42 +0200	[thread overview]
Message-ID: <20030517172942.GS1429@dualathlon.random> (raw)
In-Reply-To: <1053131245.2690.78.camel@ibm-c.pdx.osdl.net>

On Fri, May 16, 2003 at 05:27:25PM -0700, Daniel McNeil wrote:
> On Thu, 2003-05-15 at 16:17, Andrea Arcangeli wrote:
> 
> > no, the spin_lock only acts as a barrier in one way, not both ways, so
> > an smp_something is still needed.
> > 
> 
> Can you explain this more?  On a x86, isn't a spin_lock a lock; dec
> instruction and the rmb() a lock; addl.  I thought x86 instructions
> with lock prefix provided a memory barrier.

spin_lock yes on x86, but spin_unlock isn't a two way barrier even on
x86. Other archs like ia64 have special ways to declare the direction of
the barrier so they can do it for spin_lock too, not only for
spin_unlock like on the x86.

In short stuff outside the critical section can anways enter inside
unless a full mb() is executed either before or after the
spin_lock/spin_unlock. Never rely on a single spin_lock/spin_unlock to be a mb().

In short:

	spin_lock
	spin_unlock

is a mb().

But:

	spin_unlock
	spin_lock

is not an mb (and the above is what we have in our code, and this is why
I had to add the mb(), of course we just agreed it can be reduced to
smp_rmb()).

Andrea

WARNING: multiple messages have this Message-ID (diff)
From: Andrea Arcangeli <andrea@suse.de>
To: Daniel McNeil <daniel@osdl.org>
Cc: Andrew Morton <akpm@digeo.com>,
	dmccr@us.ibm.com, mika.penttila@kolumbus.fi, linux-mm@kvack.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Race between vmtruncate and mapped areas?
Date: Sat, 17 May 2003 19:29:42 +0200	[thread overview]
Message-ID: <20030517172942.GS1429@dualathlon.random> (raw)
In-Reply-To: <1053131245.2690.78.camel@ibm-c.pdx.osdl.net>

On Fri, May 16, 2003 at 05:27:25PM -0700, Daniel McNeil wrote:
> On Thu, 2003-05-15 at 16:17, Andrea Arcangeli wrote:
> 
> > no, the spin_lock only acts as a barrier in one way, not both ways, so
> > an smp_something is still needed.
> > 
> 
> Can you explain this more?  On a x86, isn't a spin_lock a lock; dec
> instruction and the rmb() a lock; addl.  I thought x86 instructions
> with lock prefix provided a memory barrier.

spin_lock yes on x86, but spin_unlock isn't a two way barrier even on
x86. Other archs like ia64 have special ways to declare the direction of
the barrier so they can do it for spin_lock too, not only for
spin_unlock like on the x86.

In short stuff outside the critical section can anways enter inside
unless a full mb() is executed either before or after the
spin_lock/spin_unlock. Never rely on a single spin_lock/spin_unlock to be a mb().

In short:

	spin_lock
	spin_unlock

is a mb().

But:

	spin_unlock
	spin_lock

is not an mb (and the above is what we have in our code, and this is why
I had to add the mb(), of course we just agreed it can be reduced to
smp_rmb()).

Andrea
--
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:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2003-05-17 17:16 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-13 20:44 Race between vmtruncate and mapped areas? Dave McCracken
2003-05-13 20:44 ` Dave McCracken
2003-05-13 20:58 ` Mika Penttilä
2003-05-13 20:58   ` Mika Penttilä
2003-05-13 21:04   ` William Lee Irwin III
2003-05-13 21:04     ` William Lee Irwin III
2003-05-13 22:26   ` Dave McCracken
2003-05-13 22:26     ` Dave McCracken
2003-05-13 22:49     ` William Lee Irwin III
2003-05-13 22:49       ` William Lee Irwin III
2003-05-13 23:00       ` Dave McCracken
2003-05-13 23:11         ` William Lee Irwin III
2003-05-13 23:11           ` William Lee Irwin III
2003-05-13 23:16           ` Dave McCracken
2003-05-13 23:16             ` Dave McCracken
2003-05-13 23:20             ` William Lee Irwin III
2003-05-13 23:20               ` William Lee Irwin III
2003-05-13 23:28               ` Dave McCracken
2003-05-13 23:28                 ` Dave McCracken
2003-05-13 23:29                 ` William Lee Irwin III
2003-05-13 23:29                   ` William Lee Irwin III
2003-05-13 23:16         ` William Lee Irwin III
2003-05-13 23:16           ` William Lee Irwin III
2003-05-14  1:10         ` Andrew Morton
2003-05-14  1:10           ` Andrew Morton
2003-05-14 15:02           ` Dave McCracken
2003-05-14 15:02             ` Dave McCracken
2003-05-14  1:10     ` Andrew Morton
2003-05-14  1:10       ` Andrew Morton
2003-05-14 15:02       ` Dave McCracken
2003-05-14 15:02         ` Dave McCracken
2003-05-14 15:06         ` William Lee Irwin III
2003-05-14 15:06           ` William Lee Irwin III
2003-05-14 15:25           ` Dave McCracken
2003-05-14 15:25             ` Dave McCracken
2003-05-14 16:42           ` Gerrit Huizenga
2003-05-14 16:42             ` Gerrit Huizenga
2003-05-14 17:34         ` Andrew Morton
2003-05-14 17:34           ` Andrew Morton
2003-05-14 17:42           ` Dave McCracken
2003-05-14 17:42             ` Dave McCracken
2003-05-14 17:57             ` Andrew Morton
2003-05-14 17:57               ` Andrew Morton
2003-05-14 18:05               ` Dave McCracken
2003-05-14 18:05                 ` Dave McCracken
2003-05-14 18:17                 ` Andrew Morton
2003-05-14 18:17                   ` Andrew Morton
2003-05-14 18:24                   ` Dave McCracken
2003-05-14 18:24                     ` Dave McCracken
2003-05-14 18:53                     ` Andrew Morton
2003-05-14 18:53                       ` Andrew Morton
2003-05-15  8:50                       ` Andrea Arcangeli
2003-05-15  8:50                         ` Andrea Arcangeli
2003-05-14 19:02               ` Rik van Riel
2003-05-14 19:02                 ` Rik van Riel
2003-05-14 19:04                 ` Rik van Riel
2003-05-14 19:04                   ` Rik van Riel
2003-05-14 19:07                   ` Dave McCracken
2003-05-14 19:07                     ` Dave McCracken
2003-05-14 19:11                     ` Rik van Riel
2003-05-14 19:11                       ` Rik van Riel
2003-05-15  0:49             ` Andrea Arcangeli
2003-05-15  0:49               ` Andrea Arcangeli
2003-05-15  2:36               ` Rik van Riel
2003-05-15  2:36                 ` Rik van Riel
2003-05-15  9:46                 ` Andrea Arcangeli
2003-05-15  9:46                   ` Andrea Arcangeli
2003-05-15  9:55                   ` Andrew Morton
2003-05-15  9:55                     ` Andrew Morton
2003-05-15  8:32               ` Andrew Morton
2003-05-15  8:32                 ` Andrew Morton
2003-05-15  8:42                 ` Andrew Morton
2003-05-15  8:42                   ` Andrew Morton
2003-05-15  8:55                 ` Andrea Arcangeli
2003-05-15  8:55                   ` Andrea Arcangeli
2003-05-15  9:20                   ` Andrew Morton
2003-05-15  9:20                     ` Andrew Morton
2003-05-15  9:40                     ` Andrea Arcangeli
2003-05-15  9:40                       ` Andrea Arcangeli
2003-05-15  9:58                       ` Andrew Morton
2003-05-15  9:58                         ` Andrew Morton
2003-05-15 16:38                       ` Daniel McNeil
2003-05-15 19:19                         ` Andrea Arcangeli
2003-05-15 19:19                           ` Andrea Arcangeli
2003-05-15 22:04                           ` Daniel McNeil
2003-05-15 22:04                             ` Daniel McNeil
2003-05-15 23:17                             ` Andrea Arcangeli
2003-05-15 23:17                               ` Andrea Arcangeli
2003-05-17  0:27                               ` Daniel McNeil
2003-05-17  0:27                                 ` Daniel McNeil
2003-05-17 17:29                                 ` Andrea Arcangeli [this message]
2003-05-17 17:29                                   ` Andrea Arcangeli
2003-05-13 21:00 ` William Lee Irwin III
2003-05-13 21:00   ` William Lee Irwin III
  -- strict thread matches above, loose matches on Subject: below --
2003-05-17 18:19 Paul McKenney
2003-05-17 18:19 ` Paul McKenney
2003-05-17 18:42 ` Andrea Arcangeli
2003-05-17 18:42   ` Andrea Arcangeli
2003-05-19 18:11 Paul McKenney
2003-05-19 18:11 ` Paul McKenney

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=20030517172942.GS1429@dualathlon.random \
    --to=andrea@suse.de \
    --cc=akpm@digeo.com \
    --cc=daniel@osdl.org \
    --cc=dmccr@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mika.penttila@kolumbus.fi \
    /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.