[Xen-devel] [PATCH] xen/scheduler: remove 'name' from 'struct scheduler'

Baodong Chen posted 1 patch 13 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/1560216945-24227-1-git-send-email-chenbaodong@mxnavi.com
xen/common/sched_arinc653.c |  1 -
xen/common/sched_credit.c   |  1 -
xen/common/sched_credit2.c  |  1 -
xen/common/sched_null.c     |  1 -
xen/common/sched_rt.c       |  1 -
xen/common/schedule.c       | 12 ++++++------
xen/include/xen/sched-if.h  |  3 +--
7 files changed, 7 insertions(+), 13 deletions(-)

[Xen-devel] [PATCH] xen/scheduler: remove 'name' from 'struct scheduler'

Posted by Baodong Chen 13 weeks ago
'struct scheduler' already has member 'opt_name' and 'sched_id',
thus 'name' is a little redundant, so remove it.

Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
 xen/common/sched_arinc653.c |  1 -
 xen/common/sched_credit.c   |  1 -
 xen/common/sched_credit2.c  |  1 -
 xen/common/sched_null.c     |  1 -
 xen/common/sched_rt.c       |  1 -
 xen/common/schedule.c       | 12 ++++++------
 xen/include/xen/sched-if.h  |  3 +--
 7 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c
index a4c6d00..98d6bdd 100644
--- a/xen/common/sched_arinc653.c
+++ b/xen/common/sched_arinc653.c
@@ -701,7 +701,6 @@ a653sched_adjust_global(const struct scheduler *ops,
  * The symbol must be visible to the rest of Xen at link time.
  */
 static const struct scheduler sched_arinc653_def = {
-    .name           = "ARINC 653 Scheduler",
     .opt_name       = "arinc653",
     .sched_id       = XEN_SCHEDULER_ARINC653,
     .sched_data     = NULL,
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 7b7facb..220b179 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -2262,7 +2262,6 @@ static void csched_tick_resume(const struct scheduler *ops, unsigned int cpu)
 }
 
 static const struct scheduler sched_credit_def = {
-    .name           = "SMP Credit Scheduler",
     .opt_name       = "credit",
     .sched_id       = XEN_SCHEDULER_CREDIT,
     .sched_data     = NULL,
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index 9c1c3b4..1974e0f 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -4076,7 +4076,6 @@ csched2_deinit(struct scheduler *ops)
 }
 
 static const struct scheduler sched_credit2_def = {
-    .name           = "SMP Credit Scheduler rev2",
     .opt_name       = "credit2",
     .sched_id       = XEN_SCHEDULER_CREDIT2,
     .sched_data     = NULL,
diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c
index c9700f1..4d8a1cc 100644
--- a/xen/common/sched_null.c
+++ b/xen/common/sched_null.c
@@ -871,7 +871,6 @@ static void null_dump(const struct scheduler *ops)
 }
 
 static const struct scheduler sched_null_def = {
-    .name           = "null Scheduler",
     .opt_name       = "null",
     .sched_id       = XEN_SCHEDULER_NULL,
     .sched_data     = NULL,
diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
index f1b81f0..e46b2c2 100644
--- a/xen/common/sched_rt.c
+++ b/xen/common/sched_rt.c
@@ -1541,7 +1541,6 @@ static void repl_timer_handler(void *data){
 }
 
 static const struct scheduler sched_rtds_def = {
-    .name           = "SMP RTDS Scheduler",
     .opt_name       = "rtds",
     .sched_id       = XEN_SCHEDULER_RTDS,
     .sched_data     = NULL,
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 86341bc..d5094ba 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1729,11 +1729,11 @@ void __init scheduler_init(void)
     {
         if ( schedulers[i]->global_init && schedulers[i]->global_init() < 0 )
             schedulers[i] = NULL;
-        else if ( !ops.name && !strcmp(schedulers[i]->opt_name, opt_sched) )
+        else if ( !ops.opt_name && !strcmp(schedulers[i]->opt_name, opt_sched) )
             ops = *schedulers[i];
     }
 
-    if ( !ops.name )
+    if ( !ops.opt_name )
     {
         printk("Could not find scheduler: %s\n", opt_sched);
         for ( i = 0; i < NUM_SCHEDULERS; i++ )
@@ -1743,15 +1743,15 @@ void __init scheduler_init(void)
                 ops = *schedulers[i];
                 break;
             }
-        BUG_ON(!ops.name);
-        printk("Using '%s' (%s)\n", ops.name, ops.opt_name);
+        BUG_ON(!ops.opt_name);
+        printk("Using scheduler (%s)\n", ops.opt_name);
     }
 
     if ( cpu_schedule_up(0) )
         BUG();
     register_cpu_notifier(&cpu_schedule_nfb);
 
-    printk("Using scheduler: %s (%s)\n", ops.name, ops.opt_name);
+    printk("Using scheduler: (%s)\n", ops.opt_name);
     if ( SCHED_OP(&ops, init) )
         panic("scheduler returned error on init\n");
 
@@ -1926,7 +1926,7 @@ void schedule_dump(struct cpupool *c)
     {
         sched = c->sched;
         cpus = c->cpu_valid;
-        printk("Scheduler: %s (%s)\n", sched->name, sched->opt_name);
+        printk("Scheduler: (%s)\n", sched->opt_name);
         SCHED_OP(sched, dump_settings);
     }
     else
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index 92bc7a0..6e3d952 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -130,8 +130,7 @@ struct task_slice {
 };
 
 struct scheduler {
-    char *name;             /* full name for this scheduler      */
-    char *opt_name;         /* option name for this scheduler    */
+    const char *opt_name;   /* option name for this scheduler    */
     unsigned int sched_id;  /* ID for this scheduler             */
     void *sched_data;       /* global data pointer               */
 
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] xen/scheduler: remove 'name' from 'struct scheduler'

Posted by George Dunlap 13 weeks ago
On 6/11/19 2:35 AM, Baodong Chen wrote:
> 'struct scheduler' already has member 'opt_name' and 'sched_id',
> thus 'name' is a little redundant, so remove it.
> 
> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>

It's not redundant; one is a longer-form human-readable description,
another is a shorthand "option" description.

You can't be saving more than what, 500 bytes here?  I understand you're
trying to cut things down as small as you can, but this seems a bit
excessive.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] xen/scheduler: remove 'name' from 'struct scheduler'

Posted by chenbaodong 13 weeks ago
On 6/11/19 18:04, George Dunlap wrote:
> On 6/11/19 2:35 AM, Baodong Chen wrote:
>> 'struct scheduler' already has member 'opt_name' and 'sched_id',
>> thus 'name' is a little redundant, so remove it.
>>
>> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
> It's not redundant; one is a longer-form human-readable description,
> another is a shorthand "option" description.
>
> You can't be saving more than what, 500 bytes here?  I understand you're
> trying to cut things down as small as you can, but this seems a bit
> excessive.

Hello George,

Roger that.

I thought besides 'name', both 'opt_name' and 'sched_id' can identify

the scheduler and the 'name' mainly used in logs, thus can be removed.

As your suggestion, can leave it as it is.

>   -George
> .
>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel