Thread (42 messages) 42 messages, 9 authors, 2016-10-03

Re: page_waitqueue() considered harmful

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-09-27 17:06:29

On Tue, 27 Sep 2016 18:52:21 +0200
Peter Zijlstra [off-list ref] wrote:
On Wed, Sep 28, 2016 at 12:53:18AM +1000, Nicholas Piggin wrote:
quoted
The more interesting is the ability to avoid the barrier between fastpath
clearing a bit and testing for waiters.

unlock():                        lock() (slowpath):
clear_bit(PG_locked)             set_bit(PG_waiter)
test_bit(PG_waiter)              test_bit(PG_locked)

If this was memory ops to different words, it would require smp_mb each
side.. Being the same word, can we avoid them?   
Ah, that is the reason I put that smp_mb__after_atomic() there. You have
a cute point on them being to the same word though. Need to think about
that.
This is all assuming the store accesses are ordered, which you should get
if the stores to the different bits operate on the same address and size.
That might not be the case for some architectures, but they might not
require barriers for other reasons. That would call for an smp_mb variant
that is used for bitops on different bits but same aligned long. 

Thanks,
Nick

--
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>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help