[2.4] [PATCH] hash_page rework, take 2

Olof Johansson olof at austin.ibm.com
Fri Feb 13 09:18:25 EST 2004

Benjamin Herrenschmidt wrote:

>>* Add a smb_mb() in pte_free_sync(), to make sure that any 0-writes to
>>PTE/PMDs are seen on other processors before the free.
> Actually, what matters is before the is_locked(), we act both
> as a write barrier for the 0 and a read barrier for is_locked().
> That said... I wonder if the implementation of is_locked() shouldn't
> have a rmb() by default after all ...

I can't even find any other users of is_read_locked in the ppc64 code. I
guess it should be fixed for future reference though. :-)

As for the memory barrier: Since smb_mb() (sync) is "larger" than
smb_rmb() (lwsync), we should be fine to keep it outside the loop:

* Another CPU has taken the read lock, seeing the old PTE value: mb()
will make us see the read lock.
* Another CPU will shortly take the read lock: Either the mb() will make
them see the new PTE value, or we will see their read lock.

Does the above make sense?

>>* Make sure "newpp" is never more than 3 bits. This saves us from
>>crashing older iSeries hypervisor. Shouldn't be a problem since we don't
>>do aging in 2.4, but I prefer the more conservative approach.
> Not only crashing older HVs, but crashing the kernel with newer HVs ;)

Oops. Either way, we shouldn't be exposed more now than before on 2.4
since none of the pp code was really changed, and no flags besides
_PAGE_BUSY were redefined.

>>* Other logic fixes based on discussions on this list, mostly dealing
>>with timing windows during which _PAGE_BUSY was cleared inappropriately.
> Did you spot any case that could have affected the 2.6 version ?

I didn't look much at it yet, but there's no isync after the loop at the
top of __hash_page (add one right before "Step 2"). I can supply patch,
but it's pretty obvious where it should go...


Olof Johansson                                        Office: 4F005/905
pSeries Linux Development                             IBM Systems Group
Email: olof at austin.ibm.com                          Phone: 512-838-9858
All opinions are my own and not those of IBM

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/

More information about the Linuxppc64-dev mailing list