[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 09/12] lib/uksched: Revisit public scheduling functions


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Sun, 10 Mar 2019 22:10:02 +0200
  • Cc: Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Sun, 10 Mar 2019 20:10:19 +0000
  • Ironport-phdr: 9a23:aFwDYxdjy+GX8Y29giI7a4OllGMj4u6mDksu8pMizoh2WeGdxc26ZBaN2/xhgRfzUJnB7Loc0qyK6vimATVIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfK9+IA+qoQnMq8IbnZZsJqEtxxXTv3BGYf5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbDVwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlSgHLSY0/mHJhMJtgqxVoxWvqB5xw4PPfI2ZKOBzcr/HcN8GWWZMWNtaWSxbAoO7aosCF/QMPeFDr4nhplsOqwa1Cw+xBOP31z9Dm3j70rE90+Q6DQHG3QogE8gKsHTJtNX1KbwfXvyuzKXS1TXDcuhZ1S3n6IjPax0sp+yHU7FoccfJ1EUiGB7Jgk+TpIHlJT+ZyPoBvmqB4+duTe6jlmEqpxxrrjWsxsogkJfFi4wbx1ze6Cl0z5g5KNulQ0Bhe9GkCoFftySCOotzRcMtXn9ntT4hyr0DpZ67ZC8KyIk7xxLHa/yIbYyI4hX7WeaPJDd3nnNleLalixmu6kis0PX8VtSv31pQtCpFlcHAtnEL1xPN9siKUuZx80i81TqV1A3e6vtILV4qmafZMZIszKY8lp8JvkTCGi/2ll/2jKiTdkg85ueo7P/nYqnnpp+aLYN0jhz+MrwzmsGkHes4KRICX3CG+eunzrHj50r5TK1QjvIqiqnZrIzaJcMDq668Ag9V1Icj6xGkDzu/zdsXg2cHI0xBeB+ci4jpOkrOIOzjDfuljFWjjjFry+rBPr37DZXHNmLDn6v5fbZh905czxI+w9Bb55JTELEBIej8WknruNLFEhA5Mwm0w+f6B9VhzY4eX3yADbOdMKzIqlCE/PwgI/SUbo8PpDn9M+Ql5+LpjXIhgl8dfbOm3YENZ3C+BPhmOF+WYXzwgtcBC2gKuBAxTOnxhV2ETzFce3KyULgn6T0hFo2mEJ/JRpqxj7yZwCe7AppWa3hdClCNFHfocIOEV+0PaCKPPMBhlD0FWqa7S4I60xGhqhP1y759IeXP4CEXq4/j3sBv5+LPjREy6SB0D8OF3mCNUmF0hGIISyUo3KB4pUxy1leD0at/g/xGDtFT4e1GXRs+NZHG1ON2Ec79Wh+SNuuOHVOnRNShGnQ9Q8w8x/cKYl1hAJOygxaF2DClUJEPkLneL5sv7qPal1zsP9s1n33Bz7UgiR8iX9NSHWa9wLZi/U7JANiawA2ii6+2ePFEj2b2/2CZwD/WsQ==
  • Ironport-sdr: Fz1XKOSuZzR0bpraeNF3uR/CQOnUpUoW8tKYtHsXa1rZe8GaBaRMxjbfOP2z9UISHxHeQYHXrX +lRWGf8+Asaw==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Currently, uk_sched_start and uk_sched_started are the only scheduler
functions (which do not contain any thread reference) that are public.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/uksched/include/uk/sched.h | 18 ++++++++++++------
 lib/uksched/sched.c            |  1 +
 lib/ukschedcoop/schedcoop.c    |  5 +----
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/lib/uksched/include/uk/sched.h b/lib/uksched/include/uk/sched.h
index 0e8f1e26..2538e02d 100644
--- a/lib/uksched/include/uk/sched.h
+++ b/lib/uksched/include/uk/sched.h
@@ -86,6 +86,7 @@ struct uk_sched {
        uk_sched_thread_get_tslice_func_t thread_get_tslice;
 
        /* internal */
+       bool threads_started;
        struct uk_thread idle;
        struct uk_thread_list exited_threads;
        struct ukplat_ctx_callbacks plat_ctx_cbs;
@@ -184,12 +185,6 @@ static inline struct uk_thread *uk_sched_get_idle(struct 
uk_sched *s)
        return &s->idle;
 }
 
-/*
- * Public scheduler functions
- */
-
-void uk_sched_start(struct uk_sched *sched) __noreturn;
-
 #define uk_sched_init(s, yield_func, \
                thread_add_func, thread_remove_func, \
                thread_set_prio_func, thread_get_prio_func, \
@@ -205,6 +200,17 @@ void uk_sched_start(struct uk_sched *sched) __noreturn;
                uk_sched_register((s)); \
        } while (0)
 
+/*
+ * Public scheduler functions
+ */
+
+void uk_sched_start(struct uk_sched *sched) __noreturn;
+
+static inline bool uk_sched_started(struct uk_sched *sched)
+{
+       return sched->threads_started;
+}
+
 
 /*
  * Internal thread scheduling functions
diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
index 5f6bc685..a6f49d67 100644
--- a/lib/uksched/sched.c
+++ b/lib/uksched/sched.c
@@ -121,6 +121,7 @@ struct uk_sched *uk_sched_create(struct uk_alloc *a, size_t 
prv_size)
                return NULL;
        }
 
+       sched->threads_started = false;
        sched->allocator = a;
        UK_TAILQ_INIT(&sched->exited_threads);
        sched->prv = (void *) sched + sizeof(struct uk_sched);
diff --git a/lib/ukschedcoop/schedcoop.c b/lib/ukschedcoop/schedcoop.c
index c19a276a..27afad2b 100644
--- a/lib/ukschedcoop/schedcoop.c
+++ b/lib/ukschedcoop/schedcoop.c
@@ -36,7 +36,6 @@
 
 struct schedcoop_private {
        struct uk_thread_list thread_list;
-       int threads_started;
 };
 
 #ifdef SCHED_DEBUG
@@ -175,9 +174,8 @@ static void idle_thread_fn(void *unused __unused)
 {
        struct uk_thread *current = uk_thread_current();
        struct uk_sched *s = current->sched;
-       struct schedcoop_private *prv = s->prv;
 
-       prv->threads_started = 1;
+       s->threads_started = true;
        ukplat_lcpu_enable_irq();
 
        while (1) {
@@ -206,7 +204,6 @@ struct uk_sched *uk_schedcoop_init(struct uk_alloc *a)
 
        prv = sched->prv;
        UK_TAILQ_INIT(&prv->thread_list);
-       prv->threads_started = 0;
 
        uk_sched_idle_init(sched, NULL, idle_thread_fn);
 
-- 
2.11.0


_______________________________________________
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®.