mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
ctdb-daemon: Make sure ctdb runs with real-time priority
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
7ae7a9c463
commit
d410b20601
@ -37,7 +37,7 @@
|
||||
/*
|
||||
if possible, make this task real time
|
||||
*/
|
||||
void set_scheduler(void)
|
||||
bool set_scheduler(void)
|
||||
{
|
||||
#ifdef _AIX_
|
||||
#if HAVE_THREAD_SETSCHED
|
||||
@ -47,14 +47,15 @@ void set_scheduler(void)
|
||||
ti = 0ULL;
|
||||
if (getthrds64(getpid(), &te, sizeof(te), &ti, 1) != 1) {
|
||||
DEBUG(DEBUG_ERR, ("Unable to get thread information\n"));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (thread_setsched(te.ti_tid, 0, SCHED_RR) == -1) {
|
||||
DEBUG(DEBUG_ERR, ("Unable to set scheduler to SCHED_RR (%s)\n",
|
||||
strerror(errno)));
|
||||
return false;
|
||||
} else {
|
||||
DEBUG(DEBUG_NOTICE, ("Set scheduler to SCHED_RR\n"));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#else /* no AIX */
|
||||
@ -70,11 +71,13 @@ void set_scheduler(void)
|
||||
if (sched_setscheduler(0, policy, &p) == -1) {
|
||||
DEBUG(DEBUG_CRIT,("Unable to set scheduler to SCHED_FIFO (%s)\n",
|
||||
strerror(errno)));
|
||||
return false;
|
||||
} else {
|
||||
DEBUG(DEBUG_NOTICE,("Set scheduler to SCHED_FIFO\n"));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1090,7 +1090,7 @@ void ctdb_call_resend_all(struct ctdb_context *ctdb);
|
||||
void ctdb_node_dead(struct ctdb_node *node);
|
||||
void ctdb_node_connected(struct ctdb_node *node);
|
||||
bool ctdb_blocking_freeze(struct ctdb_context *ctdb);
|
||||
void set_scheduler(void);
|
||||
bool set_scheduler(void);
|
||||
void reset_scheduler(void);
|
||||
|
||||
struct tevent_signal *ctdb_init_sigchld(struct ctdb_context *ctdb);
|
||||
|
@ -1183,7 +1183,10 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog)
|
||||
|
||||
if (ctdb->do_setsched) {
|
||||
/* try to set us up as realtime */
|
||||
set_scheduler();
|
||||
if (!set_scheduler()) {
|
||||
exit(1);
|
||||
}
|
||||
DEBUG(DEBUG_NOTICE, ("Set real-time scheduler priority\n"));
|
||||
}
|
||||
|
||||
/* ensure the socket is deleted on exit of the daemon */
|
||||
|
@ -123,7 +123,10 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
set_scheduler();
|
||||
if (!set_scheduler()) {
|
||||
fprintf(stderr, "%s: Unable to set real-time scheduler priority\n",
|
||||
progname);
|
||||
}
|
||||
|
||||
log_fd = atoi(argv[1]);
|
||||
close(STDOUT_FILENO);
|
||||
|
Loading…
x
Reference in New Issue
Block a user