[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5506509F.1040108@gmail.com>
Date: Mon, 16 Mar 2015 05:40:15 +0200
From: Matthias Bonne <lemonlime51@...il.com>
To: Rabin Vincent <rabin@....in>
CC: Davidlohr Bueso <dave@...olabs.net>,
Yann Droneaud <ydroneaud@...eya.com>,
kernelnewbies@...nelnewbies.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: Question on mutex code
On 03/16/15 00:10, Rabin Vincent wrote:
> On Sun, Mar 15, 2015 at 11:49:07PM +0200, Matthias Bonne wrote:
>> So the counter is set to 1 before taking the spinlock, which I think
>> might cause the race. Did I miss something?
>
> Yes, you miss the fact that __mutex_slowpath_needs_to_unlock() is 0 for
> the CONFIG_DEBUG_MUTEXES case:
>
> #ifdef CONFIG_DEBUG_MUTEXES
> # include "mutex-debug.h"
> # include <asm-generic/mutex-null.h>
> /*
> * Must be 0 for the debug case so we do not do the unlock outside of the
> * wait_lock region. debug_mutex_unlock() will do the actual unlock in this
> * case.
> */
> # undef __mutex_slowpath_needs_to_unlock
> # define __mutex_slowpath_needs_to_unlock() 0
>
Right, I overlooked this part. Thanks to both of you for the
clarifications.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists