[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


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 8 Jul 2019 11:33:43 +0300
  • Cc: felipe.huici@xxxxxxxxx, simon.kuenzer@xxxxxxxxx
  • Delivery-date: Mon, 08 Jul 2019 08:53:10 +0000
  • Ironport-phdr: 9a23:QPjsOhY+caMu/m6cZcj0VlP/LSx+4OfEezUN459isYplN5qZr8u/bnLW6fgltlLVR4KTs6sC17OM9fy4EjRcqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5sIBmsogjdqsYajZdtJ60s1hbHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlSEKPCM7/m7KkMx9lKJVrgy8qRJxwIDaZ4OaNPRlc6/BYd8XX3ZNU9xNWyBdBI63cosBD/AGPeZdt4TwuVwOrQCiBQmtAuPk1zlGhmLu3a0nzu8sFh3J3As7H9ISsXTUqs/5NKMPUeCt0anF1inMb+hM1Tfl9YjHaQotoeuLXb9pd8fa1EohFxvdg1mNpoHpIimZ2+cNvmSB8eZsS+Cih3Qppg1pvzSiydoghpPKi48V0FzI6yt0zYgvKdGlR0N3f9ipG4ZKuS6ALYt5WMYiTnltuCY917IJp4a2fDMPyJQ73x7fbOGHc5SQ7hLjSumRJTB4iWp7eLK6nRmy8EygxvfgWcmvylpKtjdFncLWunAX0Bzf8smHSv1j8Ue9wTuDyg/e5vxeLU03lafXMYAtzqAym5YJv0nPBir2l1/3jK+SeEUk4O+o6+H/b7r6oZ+cLJN0igD4Mqg0nsy/HPw4MhUVUmeH4uSwzqXj/VDiT7lQlP02lbHVsIrGKsQDuq65HwhV354m6xa+CTem0dMYnWIeIF1YZh2HkZbmO1XVLfD8DPe/mEiskCxxy/HJILLhBI/BLn/ZkLfuZbx98VJTyBIvzdBD4JJZEr8BL+z3Wk/wrNzXEAU1Mwypw+bmFNp915gTWWSRDaCFNKPdq0SH6vgxLOmRfIUVoiryK+A55/7yin80gUQdfais3ZsQbnC0BPdmI1iHbnrqg9YOD30KsxE4TOP0lFKCVSRcaG2oU60i+zFoQL6hWILCQIGqm/mN0Tm2GrVSZ3taERacHHGucJ+LCNkWbyfHCch6jj0CHZy8U5JpgRqprxP7zfxjM/LJ0iYD84r+3p5v4LuAxlkJ6TVoApHFgCm2RGZukzZQSg==
  • Ironport-sdr: /7XB7Ezf9GD0DcW4xHhPVQ6QQzX7j+QBCIX3lGnf7Bfnx/7pOUr2/y9xEBV3vhsQ2RxBsDOBBg Whc9NkQm0GSg==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.