@cryptotaxi247 / netdata-1 / commits / 506f62730

add more logging for tracing scheduler policy errors; #3438

Costa Tsaousis (ktsaou) committed Mar 9, 2018 at 00:47 UTC 506f62730c79ed82f2c43f48cf635413aeca62ca
1 file changed +7 -4
src/daemon.c
+7 -4
@@ -275,14 +275,16 @@ static void sched_setscheduler_set(void) {
275 priority = (int)config_get_number(CONFIG_SECTION_GLOBAL, "process scheduling priority", priority);
276
277 #ifdef HAVE_SCHED_GET_PRIORITY_MIN
278 + errno = 0;
279 if(priority < sched_get_priority_min(policy)) {
279 - error("scheduler %s priority %d is below the minimum %d. Using the minimum.", name, priority, sched_get_priority_min(policy));
280 + error("scheduler %s (%d) priority %d is below the minimum %d. Using the minimum.", name, policy, priority, sched_get_priority_min(policy));
281 priority = sched_get_priority_min(policy);
282 }
283 #endif
284 #ifdef HAVE_SCHED_GET_PRIORITY_MAX
285 + errno = 0;
286 if(priority > sched_get_priority_max(policy)) {
285 - error("scheduler %s priority %d is above the maximum %d. Using the maximum.", name, priority, sched_get_priority_max(policy));
287 + error("scheduler %s (%d) priority %d is above the maximum %d. Using the maximum.", name, policy, priority, sched_get_priority_max(policy));
288 priority = sched_get_priority_max(policy);
289 }
290 #endif
@@ -299,12 +301,13 @@ static void sched_setscheduler_set(void) {
301 .sched_priority = priority
302 };
303
304 + errno = 0;
305 i = sched_setscheduler(0, policy, &param);
306 if(i != 0) {
304 - error("Cannot adjust netdata scheduling policy to %s (%d), with priority %d. Falling back to nice", name, policy, priority);
307 + error("Cannot adjust netdata scheduling policy to %s (%d), with priority %d. Falling back to nice.", name, policy, priority);
308 }
309 else {
307 - debug(D_SYSTEM, "Adjusted netdata scheduling policy to %s (%d), with priority %d.", name, policy, priority);
310 + info("Adjusted netdata scheduling policy to %s (%d), with priority %d.", name, policy, priority);
311 if(!(flags & SCHED_FLAG_USE_NICE))
312 return;
313 }