[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 14/23] lib/uksched: Add scheduling related private info on threads
We introduce `sched_prv` field which will be used for keeping scheduler private information on each thread. One such example is keeping thread priorities and time slices for preemptive scheduling. Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx> --- lib/uksched/include/uk/thread.h | 1 + lib/uksched/sched.c | 2 ++ lib/uksched/thread.c | 1 + 3 files changed, 4 insertions(+) diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h index cf10b438..3c622d7f 100644 --- a/lib/uksched/include/uk/thread.h +++ b/lib/uksched/include/uk/thread.h @@ -58,6 +58,7 @@ struct uk_thread { bool detached; struct uk_waitq waiting_threads; struct uk_sched *sched; + void *sched_prv; void *prv; #ifdef CONFIG_LIBNEWLIBC struct _reent reent; diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c index 66a7656b..7422da6b 100644 --- a/lib/uksched/sched.c +++ b/lib/uksched/sched.c @@ -249,6 +249,8 @@ void uk_sched_thread_destroy(struct uk_sched *sched, struct uk_thread *thread) UK_ASSERT(is_exited(thread)); UK_TAILQ_REMOVE(&sched->exited_threads, thread, thread_list); + if (thread->sched_prv) + uk_free(sched->allocator, thread->sched_prv); uk_thread_fini(thread, sched->allocator); uk_pfree(sched->allocator, thread->stack, STACK_SIZE_PAGE_ORDER); if (thread->tls) diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c index 53a4ba48..60ebcdc5 100644 --- a/lib/uksched/thread.c +++ b/lib/uksched/thread.c @@ -113,6 +113,7 @@ int uk_thread_init(struct uk_thread *thread, thread->detached = false; uk_waitq_init(&thread->waiting_threads); thread->sched = NULL; + thread->sched_prv = NULL; thread->prv = NULL; #ifdef CONFIG_LIBNEWLIBC -- 2.20.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |