This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: linuxthreads/spinlock.c bug


On 19 Oct 2001, Wolfram Gloger wrote:

> > I propose to scrap the ``optimization'' in wait_node_alloc/free and just
> > use malloc/free directly.
> 
> Couldn't we just use the code conditional on !HAS_COMPARE_AND_SWAP
> with the spinlock?  Isn't there the assumption elsewhere that
> wait_node's are never actually free()d?

I think that the only such assumption is in wait_node_alloc's atomic
dequeue, because it dereferences the head node pointer, so
that it can replace head with head->next.

Note that most waitnodes are deleted after use, because they
are automatically allocated! Only the _pthread_alt_timedlock operation
dynamically allocates a waitnode, so that the calling thread can abandon
it (leave it in the queue to be ``garbage collected'' by a lock owner).

So changes to wait_node_alloc and wait_node_free only affect code which
actually uses timed out waits; likewise, bugs in these two only break
such code.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]