ecore thread - feedback threads should not be background threads...

if try_no_queue is used - its a thread that clearly wantt to be out of
the queue to run on its own so probably wants to wake up accurately
and thus not be a backgroun rpriority task but and urgent one. ensure
we set up priority accordingly as we didn't before. this should fix
scheduling when under load for vsync

@fix
This commit is contained in:
Carsten Haitzler 2020-05-21 18:00:47 +01:00
parent 859faad17b
commit a555fbf769
2 changed files with 38 additions and 5 deletions

View File

@ -40,6 +40,7 @@
# define PHE(x, y) eina_thread_equal(x, y)
# define PHS() eina_thread_self()
# define PHC(x, f, d) eina_thread_create(&(x), EINA_THREAD_BACKGROUND, -1, (void *)f, d)
# define PHC2(x, f, d)eina_thread_create(&(x), EINA_THREAD_URGENT, -1, (void *)f, d)
# define PHJ(x) eina_thread_join(x)
typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker;
@ -953,7 +954,7 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
eina_threads_init();
retry_direct:
if (PHC(t, _ecore_direct_worker, worker))
if (PHC2(t, _ecore_direct_worker, worker))
{
SLKL(_ecore_pending_job_threads_mutex);
_ecore_thread_count_no_queue++;

View File

@ -141,11 +141,43 @@ _eina_internal_call(void *context)
EINA_THREAD_CLEANUP_PUSH(free, c);
if (c->prio == EINA_THREAD_BACKGROUND ||
c->prio == EINA_THREAD_IDLE)
eina_sched_prio_drop();
self = pthread_self();
if (c->prio == EINA_THREAD_IDLE)
{
struct sched_param params;
int min;
min = sched_get_priority_min(SCHED_IDLE);
params.sched_priority = min;
pthread_setschedparam(self, SCHED_IDLE, &params);
}
else if (c->prio == EINA_THREAD_BACKGROUND)
{
struct sched_param params;
int min, max;
min = sched_get_priority_min(SCHED_BATCH);
max = sched_get_priority_max(SCHED_BATCH);
params.sched_priority = (max - min) / 2;
pthread_setschedparam(self, SCHED_BATCH, &params);
}
// do nothing for normal
// else if (c->prio == EINA_THREAD_NORMAL)
// {
// }
else if (c->prio == EINA_THREAD_URGENT)
{
struct sched_param params;
int max, pol;
pthread_getschedparam(self, &pol, &params);
max = sched_get_priority_max(pol);
params.sched_priority += 5;
if (params.sched_priority > max) params.sched_priority = max;
pthread_setschedparam(self, pol, &params);
}
_eina_debug_thread_add(&self);
EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self);
r = c->func((void*) c->data, eina_thread_self());