public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* RHEL5 - clogd: Set priority scheduling for the cluster log daemon
@ 2008-09-24 6:54 Jonathan Brassow
0 siblings, 0 replies; only message in thread
From: Jonathan Brassow @ 2008-09-24 6:54 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=20451b5c73ba42447aee9f0917839258ee1dfc62
Commit: 20451b5c73ba42447aee9f0917839258ee1dfc62
Parent: 12d9370aba6ab5b987739e4016faeb26cdd906ae
Author: Jonathan Brassow <jbrassow@redhat.com>
AuthorDate: Tue Sep 23 15:29:53 2008 -0500
Committer: Jonathan Brassow <jbrassow@redhat.com>
CommitterDate: Tue Sep 23 15:29:53 2008 -0500
clogd: Set priority scheduling for the cluster log daemon
Prevents excessive waiting and allows the daemon to finish
AIS workload while under heavy I/O.
---
cmirror/src/clogd.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/cmirror/src/clogd.c b/cmirror/src/clogd.c
index 114c711..0fa00ec 100644
--- a/cmirror/src/clogd.c
+++ b/cmirror/src/clogd.c
@@ -3,6 +3,7 @@
#include <stdint.h>
#include <string.h>
#include <errno.h>
+#include <sched.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
@@ -31,6 +32,7 @@ static void process_signals(void);
static void daemonize(void);
static void init_all(void);
static void cleanup_all(void);
+static void set_priority(void);
int main(int argc, char *argv[])
{
@@ -41,6 +43,8 @@ int main(int argc, char *argv[])
/* Parent can now exit, we're ready to handle requests */
kill(getppid(), SIGTERM);
+ set_priority();
+
LOG_PRINT("Starting clogd:");
LOG_PRINT(" Built: "__DATE__" "__TIME__"\n");
LOG_DBG(" Compiled with debugging.");
@@ -269,3 +273,18 @@ static void cleanup_all(void)
cleanup_cluster();
cleanup_queues();
}
+
+static void set_priority(void)
+{
+ struct sched_param sched_param;
+ int res;
+
+ res = sched_get_priority_max(SCHED_RR);
+ if (res != -1) {
+ sched_param.sched_priority = res;
+ res = sched_setscheduler(0, SCHED_RR, &sched_param);
+ }
+
+ if (res == -1)
+ LOG_ERROR("Unable to set SCHED_RR priority.");
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-23 20:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-24 6:54 RHEL5 - clogd: Set priority scheduling for the cluster log daemon Jonathan Brassow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).