]> xenbits.xensource.com Git - people/hx242/xen.git/commitdiff
xen: cpupool: add a back-pointer from a scheduler to its pool
authorDario Faggioli <dfaggioli@suse.com>
Thu, 28 May 2020 21:29:37 +0000 (23:29 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 29 May 2020 17:53:54 +0000 (18:53 +0100)
If we need to know within which pool a particular scheduler
is working, we can do that by querying the cpupool pointer
of any of the sched_resource-s (i.e., ~ any of the CPUs)
assigned to the scheduler itself.

Basically, we pick any sched_resource that we know uses that
scheduler, and we check its *cpupool pointer. If we really
know that the resource uses the scheduler, this is fine, as
it also means the resource is inside the pool we are
looking for.

But, of course, we can't do that for a pool/scheduler that has
not any been given any sched_resource yet (or if we do not
know whether or not it has any sched_resource).

To overcome such limitation, add a back pointer from the
scheduler, to its own pool.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
xen/common/sched/cpupool.c
xen/common/sched/private.h

index 0664f7fa3d130886027dc3365ada9d1b692370d5..7ea641ca261e63ee4b3ea3cd741f43e7299a4f5f 100644 (file)
@@ -287,6 +287,7 @@ static struct cpupool *cpupool_create(
         if ( c->sched == NULL )
             goto err;
     }
+    c->sched->cpupool = c;
     c->gran = opt_sched_granularity;
 
     *q = c;
index b9a5b4c01c2312962b80cbfdfb6a2997c38b7a3d..df50976eb2903bfc0f25b9a1a557b3b71411e69f 100644 (file)
@@ -275,6 +275,7 @@ struct scheduler {
     char *opt_name;         /* option name for this scheduler    */
     unsigned int sched_id;  /* ID for this scheduler             */
     void *sched_data;       /* global data pointer               */
+    struct cpupool *cpupool;/* points to this scheduler's pool   */
 
     int          (*global_init)    (void);