Hi, please find attached a patch against 2.0.2-3 which imports the fix from Ingo Molnar (http://lkml.org/lkml/2007/9/26/132) into the package.
I chose cdbs simple-patchsys and added an additional patch to revert the old incomplete one from bug #431666, but of course both can be integrated in the main tree as well (I'm currently working on converting all currently existing source patches to debian/patches). A fast import of this or a similar fix in the Debian repository would be highly appreciated. Regards, Bernhard
diff -Nru iperf-2.0.2/debian/changelog iperf-2.0.2-fixed2/debian/changelog --- iperf-2.0.2/debian/changelog 2008-03-18 02:19:21.000000000 +0100 +++ iperf-2.0.2-fixed2/debian/changelog 2008-03-18 02:16:06.000000000 +0100 @@ -1,3 +1,11 @@ +iperf (2.0.2-3.1) unstable; urgency=low + + * added proper patch for performance problem with kernels using CFS + (>= 2.6.23) (closes: #444277) + * debian/rules: using simple-patchsys from cdbs + + -- Bernhard Schmidt <[EMAIL PROTECTED]> Tue, 18 Mar 2008 02:13:32 +0100 + iperf (2.0.2-3) unstable; urgency=low * Added patch to fix poor performance with >= 2.6.21 kernels diff -Nru iperf-2.0.2/debian/control iperf-2.0.2-fixed2/debian/control --- iperf-2.0.2/debian/control 2008-03-18 02:19:21.000000000 +0100 +++ iperf-2.0.2-fixed2/debian/control 2008-03-18 02:31:26.000000000 +0100 @@ -2,7 +2,7 @@ Section: net Priority: optional Maintainer: Roberto Lumbreras <[EMAIL PROTECTED]> -Build-Depends: cdbs, debhelper (>= 5), autotools-dev +Build-Depends: cdbs, debhelper (>= 5), autotools-dev, patchutils Standards-Version: 3.7.2 Package: iperf diff -Nru iperf-2.0.2/debian/patches/001-revert-upstream-sched_yield.patch iperf-2.0.2-fixed2/debian/patches/001-revert-upstream-sched_yield.patch --- iperf-2.0.2/debian/patches/001-revert-upstream-sched_yield.patch 1970-01-01 01:00:00.000000000 +0100 +++ iperf-2.0.2-fixed2/debian/patches/001-revert-upstream-sched_yield.patch 2008-03-18 02:26:47.000000000 +0100 @@ -0,0 +1,22 @@ +Revert http://dast.nlanr.net/Projects/Iperf2.0/patch-iperf-linux-2.6.21.txt +integrated to fix bug #431366 + +--- compat/Thread.c.orig 2005-05-03 08:15:51.000000000 -0700 ++++ compat/Thread.c 2007-06-04 10:41:11.000000000 -0700 +@@ -405,13 +405,9 @@ + void thread_rest ( void ) { + #if defined( HAVE_THREAD ) + #if defined( HAVE_POSIX_THREAD ) ++ // TODO add checks for sched_yield or pthread_yield and call that ++ // if available +- +-#if defined( _POSIX_PRIORITY_SCHEDULING ) +- sched_yield(); +-#else + usleep( 0 ); +-#endif +- + #else // Win32 + SwitchToThread( ); + #endif + diff -Nru iperf-2.0.2/debian/patches/002-dont-burn-cpu-cycles-on-polling.patch iperf-2.0.2-fixed2/debian/patches/002-dont-burn-cpu-cycles-on-polling.patch --- iperf-2.0.2/debian/patches/002-dont-burn-cpu-cycles-on-polling.patch 1970-01-01 01:00:00.000000000 +0100 +++ iperf-2.0.2-fixed2/debian/patches/002-dont-burn-cpu-cycles-on-polling.patch 2008-03-18 02:27:59.000000000 +0100 @@ -0,0 +1,102 @@ +http://lkml.org/lkml/2007/9/26/132 + +-------------------------> +Subject: iperf: fix locking +From: Ingo Molnar <[EMAIL PROTECTED]> +fix iperf locking - it was burning CPU time while polling +unnecessarily, instead of using the proper wait primitives. + +Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> +--- + compat/Thread.c | 3 --- + src/Reporter.c | 13 +++++++++---- + src/main.cpp | 2 ++ + 3 files changed, 11 insertions(+), 7 deletions(-) +Index: iperf-2.0.2/compat/Thread.c +=================================================================== +--- iperf-2.0.2.orig/compat/Thread.c ++++ iperf-2.0.2/compat/Thread.c +@@ -405,9 +405,6 @@ int thread_numuserthreads( void ) { + void thread_rest ( void ) { + #if defined( HAVE_THREAD ) + #if defined( HAVE_POSIX_THREAD ) +- // TODO add checks for sched_yield or pthread_yield and call that +- // if available +- usleep( 0 ); + #else // Win32 + SwitchToThread( ); + #endif +Index: iperf-2.0.2/src/Reporter.c +=================================================================== +--- iperf-2.0.2.orig/src/Reporter.c ++++ iperf-2.0.2/src/Reporter.c +@@ -111,6 +111,7 @@ report_statistics multiple_reports[kRepo + char buffer[64]; // Buffer for printing + ReportHeader *ReportRoot = NULL; + extern Condition ReportCond; ++extern Condition ReportDoneCond; + int reporter_process_report ( ReportHeader *report ); + void process_report ( ReportHeader *report ); + int reporter_handle_packet( ReportHeader *report ); +@@ -338,7 +339,7 @@ void ReportPacket( ReportHeader* agent, + // item + while ( index == 0 ) { + Condition_Signal( &ReportCond ); +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } + agent->agentindex = 0; +@@ -346,7 +347,7 @@ void ReportPacket( ReportHeader* agent, + // Need to make sure that reporter is not about to be "lapped" + while ( index - 1 == agent->agentindex ) { + Condition_Signal( &ReportCond ); +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } + +@@ -553,6 +554,7 @@ void reporter_spawn( thread_Settings *th + } + Condition_Unlock ( ReportCond ); + ++again: + if ( ReportRoot != NULL ) { + ReportHeader *temp = ReportRoot; + //Condition_Unlock ( ReportCond ); +@@ -575,9 +577,12 @@ void reporter_spawn( thread_Settings *th + // finished with report so free it + free( temp ); + Condition_Unlock ( ReportCond ); ++ Condition_Signal( &ReportDoneCond ); ++ if (ReportRoot) ++ goto again; + } +- // yield control of CPU is another thread is waiting +- thread_rest(); ++ Condition_Signal( &ReportDoneCond ); ++ usleep(10000); + } else { + //Condition_Unlock ( ReportCond ); + } +Index: iperf-2.0.2/src/main.cpp +=================================================================== +--- iperf-2.0.2.orig/src/main.cpp ++++ iperf-2.0.2/src/main.cpp +@@ -96,6 +96,7 @@ extern "C" { + // records being accessed in a report and also to + // serialize modification of the report list + Condition ReportCond; ++ Condition ReportDoneCond; + } + + // global variables only accessed within this file +@@ -141,6 +142,7 @@ int main( int argc, char **argv ) { + + // Initialize global mutexes and conditions + Condition_Initialize ( &ReportCond ); ++ Condition_Initialize ( &ReportDoneCond ); + Mutex_Initialize( &groupCond ); + Mutex_Initialize( &clients_mutex ); + + diff -Nru iperf-2.0.2/debian/rules iperf-2.0.2-fixed2/debian/rules --- iperf-2.0.2/debian/rules 2008-03-18 02:19:21.000000000 +0100 +++ iperf-2.0.2-fixed2/debian/rules 2008-03-18 01:13:37.000000000 +0100 @@ -2,6 +2,7 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/rules/simple-patchsys.mk makebuilddir:: rm -f config.sub config.guess config.h