lkml.org 
[lkml]   [2014]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mm,console: circular dependency between console_sem and zone lock
On Mon, Jun 02, 2014 at 09:55:29PM -0400, Steven Rostedt wrote:
> Hmm, it failed on a try lock, but on the spinlock within the trylock. I
> wonder if we should add this.
>
> Peter?
>
> -- Steve
>
> diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
> index 6815171..6579f84 100644
> --- a/kernel/locking/semaphore.c
> +++ b/kernel/locking/semaphore.c
> @@ -132,7 +132,9 @@ int down_trylock(struct semaphore *sem)
> unsigned long flags;
> int count;
>
> - raw_spin_lock_irqsave(&sem->lock, flags);
> + if (!raw_spin_trylock_irqsave(&sem->lock, flags))
> + return 1;
> +
> count = sem->count - 1;
> if (likely(count >= 0))
> sem->count = count;

I prefer not to, there is no reason the down_trylock() will fail if that
spinlock is contended. We might have just hit the release in progress.

But let me stare at the original problem..
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-06-03 11:21    [W:0.276 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site