Hi,

I've attached two patches, one for configure.ac and another for 
client/app_start.c, just in case there is any interest in getting them 
upstream.

I've spent much time fiddling with Linux kernel schedulers and priorities. I 
found that rather than just setting the priority of a task to 19, in the case 
that the machine is not a dedicated cruncher, the desktop responsiveness is 
improved by setting the tasks schedule policy to BATCH, which gives it a 
slight scheduling disadvantage compared to a task running with a standard 
NORMAL/OTHER schedule policy and nice'd to 19. 

Basically, the patch results in CPU tasks running BATCH/19 and GPU tasks 
OTHER/10. In the case of a headless dedicated cruncher the PPD is not affected, 
but in the case that the machine is also running general tasks (like a code 
build and a desktop), the desktop responsiveness is greatly improved under 
heavy load.

Regards

Clive
-- 
Clive Messer <[email protected]>
--- boinc_core_release_6_6a/client/app_start.cpp.orig	2009-09-19 18:51:44.000000000 +0100
+++ boinc_core_release_6_6a/client/app_start.cpp	2009-09-19 18:55:18.000000000 +0100
@@ -57,6 +57,10 @@
 #include <fcntl.h>
 #endif
 
+#ifdef HAVE_SCHED_SETSCHEDULER
+#include <sched.h>
+#endif
+
 #include <vector>
 
 using std::vector;
@@ -934,6 +938,16 @@
             }
         }
 #endif
+#ifdef HAVE_SCHED_SETSCHEDULER
+        if (!config.no_priority_change) {
+            struct sched_param p;
+            p.sched_priority = 0;
+            if (sched_setscheduler(0, high_priority?SCHED_OTHER:SCHED_BATCH, &p)
+            ) {
+                perror("sched_setscheduler");
+            }
+        }
+#endif
         sprintf(buf, "../../%s", exec_path );
         if (g_use_sandbox) {
             char switcher_path[100];
--- boinc_core_release_6_10_6/configure.ac.orig	2009-09-20 18:00:34.000000000 +0100
+++ boinc_core_release_6_10_6/configure.ac	2009-09-23 06:34:08.000000000 +0100
@@ -643,7 +643,7 @@
 if test "${ac_cv_func_alloca_works}" = "yes" ; then
   ac_cv_func_alloca="yes"
 fi
-AC_CHECK_FUNCS(alloca _alloca __builtin_alloca ether_ntoa setpriority strlcpy strlcat strcasestr sigaction getutent setutent getisax strdup strdupa daemon stat64 putenv setenv unsetenv)
+AC_CHECK_FUNCS(alloca _alloca __builtin_alloca ether_ntoa setpriority sched_setscheduler strlcpy strlcat strcasestr sigaction getutent setutent getisax strdup strdupa daemon stat64 putenv setenv unsetenv)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to