lkml.org 
[lkml]   [2014]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] fix a race condition in cancelable mcs spinlocks
From
Date
On Mon, 2014-06-02 at 10:14 -0400, Waiman Long wrote:
> On 06/01/2014 01:53 PM, Mikulas Patocka wrote:
> > struct optimistic_spin_queue {
> > - struct optimistic_spin_queue *next, *prev;
> > + atomic_pointer_t next;
> > + struct optimistic_spin_queue *prev;
> > int locked; /* 1 if lock acquired */
> > };
>
> Is there a way to do it without changing the pointer type? It will make
> the code harder to read and understand.

I agree that it would be nice if there is a way to fix this without
changing the pointer type of "next". The change of the type to
atomic_pointer_t might make it less obvious what "next" is for. This is
then compounded with "prev" being kept as a pointer to
optimistic_spin_queue, which can further make it appear as if "next" may
potentially point to something different.




\
 
 \ /
  Last update: 2014-06-02 18:01    [W:0.246 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site