This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: linuxthreads/spinlock.c bug
- To: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- Subject: Re: linuxthreads/spinlock.c bug
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- Date: Fri, 19 Oct 2001 09:16:22 -0700 (PDT)
- cc: <libc-alpha at sourceware dot cygnus dot com>
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.