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

Re: [PATCH 3/5] xen/sched: retrieve scheduler id by name



On 15.02.22 11:15, Luca Fancellu wrote:
Add a public function to retrieve the scheduler id by the scheduler
name.

Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
  xen/common/sched/core.c | 11 +++++++++++
  xen/include/xen/sched.h | 11 +++++++++++
  2 files changed, 22 insertions(+)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 8f4b1ca10d1c..9696d3c1d769 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2947,6 +2947,17 @@ void scheduler_enable(void)
      scheduler_active = true;
  }
+int __init sched_get_id_by_name(const char *sched_name)
+{
+    unsigned int i;
+
+    for ( i = 0; i < NUM_SCHEDULERS; i++ )
+        if ( schedulers[i] && !strcmp(schedulers[i]->opt_name, sched_name) )
+            return schedulers[i]->sched_id;
+
+    return -1;
+}
+

Please make use of this function in scheduler_init(), as this
functionality is open coded there, too.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

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