Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Waiman Long
On 04/20/2016 10:36 AM, Pan Xinhui wrote: On 2016年04月20日 22:19, Peter Zijlstra wrote: On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: So there is such case that we search the whole hashtable and the lock is not found. :( Waiman assume that if l = null, the lock is not stored.

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Waiman Long
On 04/20/2016 10:36 AM, Pan Xinhui wrote: On 2016年04月20日 22:19, Peter Zijlstra wrote: On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: So there is such case that we search the whole hashtable and the lock is not found. :( Waiman assume that if l = null, the lock is not stored.

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Waiman Long
On 04/20/2016 10:19 AM, Peter Zijlstra wrote: On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: So there is such case that we search the whole hashtable and the lock is not found. :( Waiman assume that if l = null, the lock is not stored. however the lock might be there actually.

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Waiman Long
On 04/20/2016 10:19 AM, Peter Zijlstra wrote: On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: So there is such case that we search the whole hashtable and the lock is not found. :( Waiman assume that if l = null, the lock is not stored. however the lock might be there actually.

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Waiman Long
On 04/20/2016 08:08 AM, Peter Zijlstra wrote: On Thu, Apr 14, 2016 at 02:41:58PM -0400, Waiman Long wrote: Pan Xinhui was asking for a lock holder cpu argument in pv_wait() to help the porting of pvqspinlock to PPC. The new argument will can potentially help hypervisor expediate the execution

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Waiman Long
On 04/20/2016 08:08 AM, Peter Zijlstra wrote: On Thu, Apr 14, 2016 at 02:41:58PM -0400, Waiman Long wrote: Pan Xinhui was asking for a lock holder cpu argument in pv_wait() to help the porting of pvqspinlock to PPC. The new argument will can potentially help hypervisor expediate the execution

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Pan Xinhui
On 2016年04月20日 22:18, Peter Zijlstra wrote: > On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: +static struct pv_node *pv_lookup_hash(struct qspinlock *lock) +{ + unsigned long offset, hash = hash_ptr(lock, pv_lock_hash_bits); + struct pv_hash_entry *he; +

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Pan Xinhui
On 2016年04月20日 22:18, Peter Zijlstra wrote: > On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: +static struct pv_node *pv_lookup_hash(struct qspinlock *lock) +{ + unsigned long offset, hash = hash_ptr(lock, pv_lock_hash_bits); + struct pv_hash_entry *he; +

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Pan Xinhui
On 2016年04月20日 22:19, Peter Zijlstra wrote: > On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: >> So there is such case that we search the whole hashtable and the lock is not >> found. :( >> Waiman assume that if l = null, the lock is not stored. however the lock >> might be there

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Pan Xinhui
On 2016年04月20日 22:19, Peter Zijlstra wrote: > On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: >> So there is such case that we search the whole hashtable and the lock is not >> found. :( >> Waiman assume that if l = null, the lock is not stored. however the lock >> might be there

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Peter Zijlstra
On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: > So there is such case that we search the whole hashtable and the lock is not > found. :( > Waiman assume that if l = null, the lock is not stored. however the lock > might be there actually. > But to avoid the worst case I just

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Peter Zijlstra
On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: > So there is such case that we search the whole hashtable and the lock is not > found. :( > Waiman assume that if l = null, the lock is not stored. however the lock > might be there actually. > But to avoid the worst case I just

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Peter Zijlstra
On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: > >> +static struct pv_node *pv_lookup_hash(struct qspinlock *lock) > >> +{ > >> + unsigned long offset, hash = hash_ptr(lock, pv_lock_hash_bits); > >> + struct pv_hash_entry *he; > >> + > >> + for_each_hash_entry(he, offset, hash) { >

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Peter Zijlstra
On Wed, Apr 20, 2016 at 10:15:09PM +0800, Pan Xinhui wrote: > >> +static struct pv_node *pv_lookup_hash(struct qspinlock *lock) > >> +{ > >> + unsigned long offset, hash = hash_ptr(lock, pv_lock_hash_bits); > >> + struct pv_hash_entry *he; > >> + > >> + for_each_hash_entry(he, offset, hash) { >

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Pan Xinhui
Hello Peter On 2016年04月20日 20:08, Peter Zijlstra wrote: > On Thu, Apr 14, 2016 at 02:41:58PM -0400, Waiman Long wrote: >> Pan Xinhui was asking for a lock holder cpu argument in pv_wait() >> to help the porting of pvqspinlock to PPC. The new argument will can >> potentially help hypervisor

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Pan Xinhui
Hello Peter On 2016年04月20日 20:08, Peter Zijlstra wrote: > On Thu, Apr 14, 2016 at 02:41:58PM -0400, Waiman Long wrote: >> Pan Xinhui was asking for a lock holder cpu argument in pv_wait() >> to help the porting of pvqspinlock to PPC. The new argument will can >> potentially help hypervisor

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Peter Zijlstra
On Thu, Apr 14, 2016 at 02:41:58PM -0400, Waiman Long wrote: > Pan Xinhui was asking for a lock holder cpu argument in pv_wait() > to help the porting of pvqspinlock to PPC. The new argument will can > potentially help hypervisor expediate the execution of the critical > section so that the lock

Re: [PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-20 Thread Peter Zijlstra
On Thu, Apr 14, 2016 at 02:41:58PM -0400, Waiman Long wrote: > Pan Xinhui was asking for a lock holder cpu argument in pv_wait() > to help the porting of pvqspinlock to PPC. The new argument will can > potentially help hypervisor expediate the execution of the critical > section so that the lock

[PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-14 Thread Waiman Long
Pan Xinhui was asking for a lock holder cpu argument in pv_wait() to help the porting of pvqspinlock to PPC. The new argument will can potentially help hypervisor expediate the execution of the critical section so that the lock holder vCPU can release the lock sooner. This patch does just that by

[PATCH v2] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-14 Thread Waiman Long
Pan Xinhui was asking for a lock holder cpu argument in pv_wait() to help the porting of pvqspinlock to PPC. The new argument will can potentially help hypervisor expediate the execution of the critical section so that the lock holder vCPU can release the lock sooner. This patch does just that by