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

[Xen-changelog] [xen master] sched: get rid of static private schedulers' structures



commit 9c952271607a8fd4b23987bf509ded01d32f3a90
Author:     Dario Faggioli <dario.faggioli@xxxxxxxxxx>
AuthorDate: Wed Feb 24 12:02:37 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 24 12:02:37 2016 +0100

    sched: get rid of static private schedulers' structures
    
    In fact, they look rather useless: they are never
    referenced neither directly, nor via the sched_data
    pointer, as a dynamic copy that overrides them is
    allocated as the very first step of a scheduler's
    initialization.
    
    While there, take the chance to also reset the sched_data
    pointer to NULL, upon scheduler de-initialization.
    
    Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 xen/common/sched_arinc653.c | 3 ++-
 xen/common/sched_credit.c   | 7 +++----
 xen/common/sched_credit2.c  | 8 +++-----
 xen/common/sched_rt.c       | 7 +++----
 xen/include/xen/sched-if.h  | 2 +-
 5 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c
index 0606988..8a11a2f 100644
--- a/xen/common/sched_arinc653.c
+++ b/xen/common/sched_arinc653.c
@@ -367,9 +367,10 @@ a653sched_init(struct scheduler *ops)
  * @param ops       Pointer to this instance of the scheduler structure
  */
 static void
-a653sched_deinit(const struct scheduler *ops)
+a653sched_deinit(struct scheduler *ops)
 {
     xfree(SCHED_PRIV(ops));
+    ops->sched_data = NULL;
 }
 
 /**
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index bd2f37f..c336bac 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1957,13 +1957,14 @@ csched_init(struct scheduler *ops)
 }
 
 static void
-csched_deinit(const struct scheduler *ops)
+csched_deinit(struct scheduler *ops)
 {
     struct csched_private *prv;
 
     prv = CSCHED_PRIV(ops);
     if ( prv != NULL )
     {
+        ops->sched_data = NULL;
         free_cpumask_var(prv->cpus);
         free_cpumask_var(prv->idlers);
         xfree(prv);
@@ -1993,13 +1994,11 @@ static void csched_tick_resume(const struct scheduler 
*ops, unsigned int cpu)
             - now % MICROSECS(prv->tick_period_us) );
 }
 
-static struct csched_private _csched_priv;
-
 static const struct scheduler sched_credit_def = {
     .name           = "SMP Credit Scheduler",
     .opt_name       = "credit",
     .sched_id       = XEN_SCHEDULER_CREDIT,
-    .sched_data     = &_csched_priv,
+    .sched_data     = NULL,
 
     .init_domain    = csched_dom_init,
     .destroy_domain = csched_dom_destroy,
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index 2934e26..7ddad38 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -2183,22 +2183,20 @@ csched2_init(struct scheduler *ops)
 }
 
 static void
-csched2_deinit(const struct scheduler *ops)
+csched2_deinit(struct scheduler *ops)
 {
     struct csched2_private *prv;
 
     prv = CSCHED2_PRIV(ops);
+    ops->sched_data = NULL;
     xfree(prv);
 }
 
-
-static struct csched2_private _csched2_priv;
-
 static const struct scheduler sched_credit2_def = {
     .name           = "SMP Credit Scheduler rev2",
     .opt_name       = "credit2",
     .sched_id       = XEN_SCHEDULER_CREDIT2,
-    .sched_data     = &_csched2_priv,
+    .sched_data     = NULL,
 
     .init_domain    = csched2_dom_init,
     .destroy_domain = csched2_dom_destroy,
diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
index 33ac9de..bfed2e2 100644
--- a/xen/common/sched_rt.c
+++ b/xen/common/sched_rt.c
@@ -462,7 +462,7 @@ rt_init(struct scheduler *ops)
 }
 
 static void
-rt_deinit(const struct scheduler *ops)
+rt_deinit(struct scheduler *ops)
 {
     struct rt_private *prv = rt_priv(ops);
 
@@ -473,6 +473,7 @@ rt_deinit(const struct scheduler *ops)
         xfree(_cpumask_scratch);
         _cpumask_scratch = NULL;
     }
+    ops->sched_data = NULL;
     xfree(prv);
 }
 
@@ -1149,13 +1150,11 @@ rt_dom_cntl(
     return rc;
 }
 
-static struct rt_private _rt_priv;
-
 static const struct scheduler sched_rtds_def = {
     .name           = "SMP RTDS Scheduler",
     .opt_name       = "rtds",
     .sched_id       = XEN_SCHEDULER_RTDS,
-    .sched_data     = &_rt_priv,
+    .sched_data     = NULL,
 
     .dump_cpu_state = rt_dump_pcpu,
     .dump_settings  = rt_dump,
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index 66dc9c8..825f1ad 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -126,7 +126,7 @@ struct scheduler {
     int          (*global_init)    (void);
 
     int          (*init)           (struct scheduler *);
-    void         (*deinit)         (const struct scheduler *);
+    void         (*deinit)         (struct scheduler *);
 
     void         (*free_vdata)     (const struct scheduler *, void *);
     void *       (*alloc_vdata)    (const struct scheduler *, struct vcpu *,
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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