Commit 69d41d38 authored by Marek Vavrusa's avatar Marek Vavrusa

Disabled SCHED_OTHER and thread prioritization.

refs #1809
parent 35d7376b
......@@ -816,43 +816,43 @@ int dt_stop(dt_unit_t *unit)
return KNOTD_EOK;
}
int dt_setprio(dthread_t *thread, int prio)
{
// Check input
if (thread == 0) {
return KNOTD_EINVAL;
}
// Clamp priority
int policy = SCHED_FIFO;
prio = MIN(MAX(sched_get_priority_min(policy), prio),
sched_get_priority_max(policy));
// Update scheduler policy
int ret = pthread_attr_setschedpolicy(&thread->_attr, policy);
// Update priority
if (ret == 0) {
struct sched_param sp;
sp.sched_priority = prio;
ret = pthread_attr_setschedparam(&thread->_attr, &sp);
}
/* Map error codes. */
if (ret != 0) {
dbg_dt("dthreads: [%p] %s(%d): failed",
thread, __func__, prio);
/* Map "not supported". */
if (errno == ENOTSUP) {
return KNOTD_ENOTSUP;
}
return KNOTD_EINVAL;
}
return KNOTD_EOK;
}
//int dt_setprio(dthread_t *thread, int prio)
//{
// // Check input
// if (thread == 0) {
// return KNOTD_EINVAL;
// }
// // Clamp priority
// int policy = SCHED_FIFO;
// prio = MIN(MAX(sched_get_priority_min(policy), prio),
// sched_get_priority_max(policy));
// // Update scheduler policy
// int ret = pthread_attr_setschedpolicy(&thread->_attr, policy);
// // Update priority
// if (ret == 0) {
// struct sched_param sp;
// sp.sched_priority = prio;
// ret = pthread_attr_setschedparam(&thread->_attr, &sp);
// }
// /* Map error codes. */
// if (ret != 0) {
// dbg_dt("dthreads: [%p] %s(%d): failed",
// thread, __func__, prio);
// /* Map "not supported". */
// if (errno == ENOTSUP) {
// return KNOTD_ENOTSUP;
// }
// return KNOTD_EINVAL;
// }
// return KNOTD_EOK;
//}
int dt_repurpose(dthread_t *thread, runnable_t runnable, void *data)
{
......
......@@ -241,10 +241,14 @@ int dt_stop(dt_unit_t *unit);
* \param thread Target thread instance.
* \param prio Requested priority (positive integer, default is 0).
*
* \warning Thread priority setting is disabled as the compatible scheduler
* has significant performance deficiencies (SCHED_OTHER).
* (issue #1809)
*
* \retval KNOTD_EOK on success.
* \retval KNOTD_EINVAL on invalid parameters.
*/
int dt_setprio(dthread_t *thread, int prio);
//int dt_setprio(dthread_t *thread, int prio);
/*!
* \brief Set thread to execute another runnable.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment