[XviD-devel] mulithread rework

Con Kolivas kernel at kolivas.org
Tue Apr 22 12:59:08 CEST 2008


Hi all

I see not a lot of activity has been going on for a while, but I noticed there 
was multithread code in the cvs repo. I downloaded it and gave it a shot and 
found it did speed up maybe 40% but that's not a great improvement for a 4 
core machine. So I had a look at the code to see if I could help.

Now within the code I see each P frame is sliced up and encoded by different 
threads. What I also found was the sched_yield was used as a locking 
primitive which unfortunately is less than ideal. Turning the sched_yield 
into a noop makes it spin on wait burning cpu cycles doing nothing and 
actually slows the encoding down a lot. I'd like to help improve this 
threading code with some proper locking in the hope I could speed it up. 
However, I was hoping someone could tell me, exactly what is it that the 
sched_yield is giving time to; ie by yielding, what is it waiting on 
happening.

I could poke around indefinitely and I'll probably eventually find it but at 
the moment it's too obscure for me to decipher from this:

				if (current_mb >= max_mbs) {
					/* current workload is zero */
					x--;
					sched_yield();
					continue;
				}

Hopefully someone can enlighten me because I'd love to see if I could help 
make this multithreaded code scale better.

Regards.
-- 
-ck


More information about the XviD-devel mailing list