Re: Wrongly wakened pthread_cond_wait() on 2.4.18 : futex.c?

Peter Waechtler <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <1041013269.12574.35.camel@picklock>
Am Fre, 2002-12-27 um 13.10 schrieb Liu, Bing Wei:
> Patching stock 2.4.18 with patch-kngpt-2.4.18-2.0.3-2 downloaded from
> http://www-124.ibm.com/pthreads/download/stable/kernel/, I run Dr. Uwe's
> producer/consumer case against ngpt-2.0.4 on a SMP box and found it's 
> trapped in endless loop.
> 
> According to the printed info, I noticed that either producer or consumer
> will
> be hooked to endlessly wakened pthread_cond_wait() and prevent other 
> threads from grabbing the shared mutex.  Because it is using 
> PROCESS_SHARED condition variable, I traced back to the futex lines 
> and found a possible reason.
> 
> Within futex_poll() of kernel/futex.c, line 246,247 read
> 	if (!list_empty(&q->list))
> 		ret = POLLIN | POLLRDNORM;
> which means the select() on futex_fd will return right away.
> 
> Changing to
> 	if (list_empty(&q->list))
> 		ret = POLLIN | POLLRDNORM;
> and recompile the kernel, the issue will be gone.
> 
> Please correct me if I misunderstood the functions.
> 

You are correct - and spent some time on a bug that is known
and also fixed in the patch for 2.4.19. Unluckily is isn't
applied to the one against 2.4.18 :(
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.