Skip to contentSkip to conversation

cluster/group/daemon gd_internal.h main.c

Cluster-devel [email protected] 1 participant 1 message Sep 15, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-09-15 18:20:37

Modified files:
group/daemon : gd_internal.h main.c

Log message:
have groupd set the scheduler to RR priority 2, same as gfs_controld

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/gd_internal.h.diff?cvsroot=cluster&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/main.c.diff?cvsroot=cluster&r1=1.43&r2=1.44

group/daemon/gd_internal.h +1 -0
@@ -26,6 +26,7 @@
 #include <dirent.h>
 #include <syslog.h>
 #include <time.h>
+#include <sched.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/types.h>
group/daemon/main.c +20 -0
@@ -870,6 +870,24 @@
 	}
 }
 
+void set_scheduler(void)
+{
+	struct sched_param sched_param;
+	int rv;
+
+	rv = sched_get_priority_max(SCHED_RR);
+	if (rv != -1) {
+		sched_param.sched_priority = 2;
+		rv = sched_setscheduler(0, SCHED_RR, &sched_param);
+		if (rv == -1)
+			log_print("could not set SCHED_RR priority %d err %d",
+				   sched_param.sched_priority, errno);
+	} else {
+		log_print("could not get maximum scheduler priority err %d",
+			  errno);
+	}
+}
+
 int main(int argc, char *argv[])
 {
 	prog_name = argv[0];
@@ -885,6 +903,8 @@
 	if (!groupd_debug_opt)
 		daemonize();
 
+	set_scheduler();
+
 	pollfd = malloc(NALLOC * sizeof(struct pollfd));
 	if (!pollfd)
 		return -1;