Skip to contentSkip to conversation

Remove unnecessary smp_wmb from clear_user_highpage()

PATCH Oleg Nesterov 2 participants 2 messages Jul 20, 2007 Memory management

lore
Share & tools
lore
#0 lore raw

(Off-topic)

Quoted 3 lines · Linus Torvalds

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.

Quoted 4 lines

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,

Quoted 3 lines

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 7 lines · Oleg Nesterov
Quoted 3 lines · Linus Torvalds

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.

Yeah, no, I think you're right, and I'm wrong.

I think unlock+lock is a complete barrier, but lock+unlock isn't. Funny.

Quoted 1 line

This means that unlock + lock is a full barrier,

Indeed. If nothing else, because on the same lock it obviously had better be (you have two critical regions, and the whole *point* of the lock is to keep them clear of each others).

Quoted 14 lines
Quoted 3 lines

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

Quoted 6 lines
	lock();
	B;
	A;
	unlock();

Yes?

Yes, I think you're right.

Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>