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

"Liu, Bing Wei" <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <[email protected]>
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.

----------------------------------------------------------
Bingwei Liu
My words stand for personal point of view
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.