All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spinlock: Get rid of spin_can_lock()
@ 2016-05-23 13:54 Davidlohr Bueso
  2016-05-24 10:21 ` Peter Zijlstra
  2016-06-01 12:45 ` Peter Zijlstra
  0 siblings, 2 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2016-05-23 13:54 UTC (permalink / raw)
  To: mingo, peterz; +Cc: Waiman.Long, dave, linux-kernel, Davidlohr Bueso

... it has no users and we already have the the regular spin_is_lock()
call anyway -- although iirc this was going to be different
than the simple negation for lock elision implementations. Lets drop it.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 include/linux/spinlock.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 47dd0cebd204..047c6f6c3268 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -264,12 +264,6 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
 	1 : ({ local_irq_restore(flags); 0; }); \
 })
 
-/**
- * raw_spin_can_lock - would raw_spin_trylock() succeed?
- * @lock: the spinlock in question.
- */
-#define raw_spin_can_lock(lock)	(!raw_spin_is_locked(lock))
-
 /* Include rwlock functions */
 #include <linux/rwlock.h>
 
@@ -392,11 +386,6 @@ static __always_inline int spin_is_contended(spinlock_t *lock)
 	return raw_spin_is_contended(&lock->rlock);
 }
 
-static __always_inline int spin_can_lock(spinlock_t *lock)
-{
-	return raw_spin_can_lock(&lock->rlock);
-}
-
 #define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
 
 /*
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spinlock: Get rid of spin_can_lock()
  2016-05-23 13:54 [PATCH] spinlock: Get rid of spin_can_lock() Davidlohr Bueso
@ 2016-05-24 10:21 ` Peter Zijlstra
  2016-06-01 12:45 ` Peter Zijlstra
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2016-05-24 10:21 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: mingo, Waiman.Long, linux-kernel, Davidlohr Bueso

On Mon, May 23, 2016 at 06:54:02AM -0700, Davidlohr Bueso wrote:
> ... it has no users and we already have the the regular spin_is_lock()
> call anyway -- although iirc this was going to be different
> than the simple negation for lock elision implementations. Lets drop it.
> 
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> ---
>  include/linux/spinlock.h | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
> index 47dd0cebd204..047c6f6c3268 100644
> --- a/include/linux/spinlock.h
> +++ b/include/linux/spinlock.h
> @@ -264,12 +264,6 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
>  	1 : ({ local_irq_restore(flags); 0; }); \
>  })
>  
> -/**
> - * raw_spin_can_lock - would raw_spin_trylock() succeed?
> - * @lock: the spinlock in question.
> - */
> -#define raw_spin_can_lock(lock)	(!raw_spin_is_locked(lock))

Its also complete crack; there's absolutely no guarantee the trylock
would still succeed the instruction after we do this.

The only way to test if the trylock would work is actually doing it.

So yeah, queued and killed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spinlock: Get rid of spin_can_lock()
  2016-05-23 13:54 [PATCH] spinlock: Get rid of spin_can_lock() Davidlohr Bueso
  2016-05-24 10:21 ` Peter Zijlstra
@ 2016-06-01 12:45 ` Peter Zijlstra
  2016-06-06 17:27   ` Davidlohr Bueso
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2016-06-01 12:45 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: mingo, Waiman.Long, linux-kernel, Davidlohr Bueso

On Mon, May 23, 2016 at 06:54:02AM -0700, Davidlohr Bueso wrote:
> ... it has no users and we already have the the regular spin_is_lock()
> call anyway -- although iirc this was going to be different
> than the simple negation for lock elision implementations. Lets drop it.

What about {read,write}_can_lock() ? those look equally unused and
borken.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spinlock: Get rid of spin_can_lock()
  2016-06-01 12:45 ` Peter Zijlstra
@ 2016-06-06 17:27   ` Davidlohr Bueso
  0 siblings, 0 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2016-06-06 17:27 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, Waiman.Long, linux-kernel, Davidlohr Bueso

On Wed, 01 Jun 2016, Peter Zijlstra wrote:

>On Mon, May 23, 2016 at 06:54:02AM -0700, Davidlohr Bueso wrote:
>> ... it has no users and we already have the the regular spin_is_lock()
>> call anyway -- although iirc this was going to be different
>> than the simple negation for lock elision implementations. Lets drop it.
>
>What about {read,write}_can_lock() ? those look equally unused and
>borken.

Hmm so the break_lock thingie for archs that don't have ticket locks (or
queued obviously) want to use these, mainly for is_contended() usage afaict.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-06 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23 13:54 [PATCH] spinlock: Get rid of spin_can_lock() Davidlohr Bueso
2016-05-24 10:21 ` Peter Zijlstra
2016-06-01 12:45 ` Peter Zijlstra
2016-06-06 17:27   ` Davidlohr Bueso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.