linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Hugh Dickins <hugh@veritas.com>, Mel Gorman <mel@skynet.ie>,
	Nick Piggin <npiggin@suse.de>,
	linux-mm@kvack.org
Subject: Re: [PATCH] Remove unnecessary smp_wmb from clear_user_highpage()
Date: Sat, 21 Jul 2007 01:06:11 +0400	[thread overview]
Message-ID: <20070720210610.GA148@tv-sign.ru> (raw)

(Off-topic)

Linus Torvalds wrote:
>
> A full lock/unlock *pair* should (as far as I know) always be equivalent 
> to a full memory barrier.

Is it so? I am not arguing, I am trying to understand.

> Because, by definition, no reads or writes 
> inside the locked region may escape outside it, and that in turn implies 
> that no access _outside_ the locked region may escape to the other side of 
> it.

This means that unlock + lock is a full barrier,

> However, neither a "lock" nor an "unlock" on *its*own* is a barrier at 
> all, at most they are semi-permeable barriers for some things, where 
> different architectures can be differently semi-permeable.

and this means that lock + unlock is not.

	A;
	lock();
	unlock();
	B;

If both A and B can leak into the critical section, they could be reordered
inside this section, so we can have

	lock();
	B;
	A;
	unlock();

Yes?

Oleg.

--
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:[~2007-07-20 21:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-20 21:06 Oleg Nesterov [this message]
2007-07-20 21:57 ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2007-07-18 15:05 Mel Gorman
2007-07-18 16:45 ` Hugh Dickins
2007-07-19  2:17   ` Nick Piggin
2007-07-20 13:08     ` Mel Gorman
2007-07-23  2:02       ` Nick Piggin
2007-07-19  2:28   ` Linus Torvalds
2007-07-19  2:58     ` Nick Piggin
2007-07-19  2:36   ` Nick Piggin
2007-07-19 11:16   ` Mel Gorman
2007-07-19  1:57 ` Nick Piggin

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=20070720210610.GA148@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=hugh@veritas.com \
    --cc=linux-mm@kvack.org \
    --cc=mel@skynet.ie \
    --cc=npiggin@suse.de \
    --cc=torvalds@linux-foundation.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