[Cluster-devel] cluster/group/daemon gd_internal.h main.c

teigland at sourceware.org teigland at sourceware.org
Fri Sep 15 18:20:38 UTC 2006


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

--- cluster/group/daemon/gd_internal.h	2006/09/12 21:57:05	1.39
+++ cluster/group/daemon/gd_internal.h	2006/09/15 18:20:36	1.40
@@ -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>
--- cluster/group/daemon/main.c	2006/09/14 20:49:38	1.43
+++ cluster/group/daemon/main.c	2006/09/15 18:20:36	1.44
@@ -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;




More information about the Cluster-devel mailing list