All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] schedule: move last_run_time to the credit scheduler privates
@ 2018-09-11  8:10 Andrii Anisov
  2018-09-11  8:29 ` Jan Beulich
  2018-09-12  8:14 ` Dario Faggioli
  0 siblings, 2 replies; 5+ messages in thread
From: Andrii Anisov @ 2018-09-11  8:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Tim Deegan, Stefano Stabellini, Andrii Anisov,
	Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper, Ian Jackson,
	Dario Faggioli, Julien Grall, Jan Beulich, xen-devel, Wei Liu

From: Andrii Anisov <andrii_anisov@epam.com>

The structure member last_run_time is used by a credit scheduler only.
So move it from a generic vcpu sctructure to the credit scheduler private
vcpu definition.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
---
 xen/common/sched_credit.c | 12 +++++++++---
 xen/common/schedule.c     |  1 -
 xen/include/xen/sched.h   |  3 ---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 84e744b..7170172 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -175,6 +175,9 @@ struct csched_vcpu {
     atomic_t credit;
     unsigned int residual;
 
+    /* last time when vCPU is scheduled out */
+    uint64_t last_run_time;
+
 #ifdef CSCHED_STATS
     struct {
         int credit_last;
@@ -701,10 +704,11 @@ static unsigned int vcpu_migration_delay_us;
 integer_param("vcpu_migration_delay", vcpu_migration_delay_us);
 
 static inline bool
-__csched_vcpu_is_cache_hot(const struct csched_private *prv, struct vcpu *v)
+__csched_vcpu_is_cache_hot(const struct csched_private *prv,
+                           struct csched_vcpu * scurr)
 {
     bool hot = prv->vcpu_migr_delay &&
-               (NOW() - v->last_run_time) < prv->vcpu_migr_delay;
+               (NOW() - scurr->last_run_time) < prv->vcpu_migr_delay;
 
     if ( hot )
         SCHED_STAT_CRANK(vcpu_hot);
@@ -716,6 +720,7 @@ static inline int
 __csched_vcpu_is_migrateable(const struct csched_private *prv, struct vcpu *vc,
                              int dest_cpu, cpumask_t *mask)
 {
+    struct csched_vcpu * scurr = CSCHED_VCPU(vc);
     /*
      * Don't pick up work that's hot on peer PCPU, or that can't (or
      * would prefer not to) run on cpu.
@@ -725,7 +730,7 @@ __csched_vcpu_is_migrateable(const struct csched_private *prv, struct vcpu *vc,
      */
     ASSERT(!vc->is_running);
 
-    return !__csched_vcpu_is_cache_hot(prv, vc) &&
+    return !__csched_vcpu_is_cache_hot(prv, scurr) &&
            cpumask_test_cpu(dest_cpu, mask);
 }
 
@@ -1869,6 +1874,7 @@ csched_schedule(
         /* Update credits of a non-idle VCPU. */
         burn_credits(scurr, now);
         scurr->start_time -= now;
+        scurr->last_run_time = now;
     }
     else
     {
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 05281d6..3c299ca 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1556,7 +1556,6 @@ static void schedule(void)
         ((prev->pause_flags & VPF_blocked) ? RUNSTATE_blocked :
          (vcpu_runnable(prev) ? RUNSTATE_runnable : RUNSTATE_offline)),
         now);
-    prev->last_run_time = now;
 
     ASSERT(next->runstate.state != RUNSTATE_running);
     vcpu_runstate_change(next, RUNSTATE_running, now);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 0ba80cb..b6b2c43 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -173,9 +173,6 @@ struct vcpu
     } runstate_guest; /* guest address */
 #endif
 
-    /* last time when vCPU is scheduled out */
-    uint64_t last_run_time;
-
     /* Has the FPU been initialised? */
     bool             fpu_initialised;
     /* Has the FPU been used since it was last saved? */
-- 
2.7.4


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] schedule: move last_run_time to the credit scheduler privates
  2018-09-11  8:10 [PATCH] schedule: move last_run_time to the credit scheduler privates Andrii Anisov
@ 2018-09-11  8:29 ` Jan Beulich
  2018-09-11 16:08   ` Dario Faggioli
  2018-09-12  8:14 ` Dario Faggioli
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2018-09-11  8:29 UTC (permalink / raw)
  To: andrii.anisov
  Cc: Tim Deegan, Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Dario Faggioli,
	Julien Grall, xen-devel, andrii_anisov

>>> On 11.09.18 at 10:10, <andrii.anisov@gmail.com> wrote:
> From: Andrii Anisov <andrii_anisov@epam.com>
> 
> The structure member last_run_time is used by a credit scheduler only.
> So move it from a generic vcpu sctructure to the credit scheduler private
> vcpu definition.
> 
> Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
> ---
>  xen/common/sched_credit.c | 12 +++++++++---
>  xen/common/schedule.c     |  1 -
>  xen/include/xen/sched.h   |  3 ---
>  3 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
> index 84e744b..7170172 100644
> --- a/xen/common/sched_credit.c
> +++ b/xen/common/sched_credit.c
> @@ -175,6 +175,9 @@ struct csched_vcpu {
>      atomic_t credit;
>      unsigned int residual;
>  
> +    /* last time when vCPU is scheduled out */
> +    uint64_t last_run_time;
> +
>  #ifdef CSCHED_STATS
>      struct {
>          int credit_last;
> @@ -701,10 +704,11 @@ static unsigned int vcpu_migration_delay_us;
>  integer_param("vcpu_migration_delay", vcpu_migration_delay_us);
>  
>  static inline bool
> -__csched_vcpu_is_cache_hot(const struct csched_private *prv, struct vcpu *v)
> +__csched_vcpu_is_cache_hot(const struct csched_private *prv,
> +                           struct csched_vcpu * scurr)

Stray blank, and it looks like the parameter can be pointer to const.
Similar further down.

Jan



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] schedule: move last_run_time to the credit scheduler privates
  2018-09-11  8:29 ` Jan Beulich
@ 2018-09-11 16:08   ` Dario Faggioli
  0 siblings, 0 replies; 5+ messages in thread
From: Dario Faggioli @ 2018-09-11 16:08 UTC (permalink / raw)
  To: andrii.anisov
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Tim Deegan, Julien Grall,
	andrii_anisov, Jan Beulich, xen-devel, Ian Jackson


[-- Attachment #1.1: Type: text/plain, Size: 1360 bytes --]

On Tue, 2018-09-11 at 02:29 -0600, Jan Beulich wrote:
> > > > On 11.09.18 at 10:10, <andrii.anisov@gmail.com> wrote:
> > 
> > From: Andrii Anisov <andrii_anisov@epam.com>
> > 
> > diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
> > index 84e744b..7170172 100644
> > 
> > @@ -701,10 +704,11 @@ static unsigned int vcpu_migration_delay_us;
> >  integer_param("vcpu_migration_delay", vcpu_migration_delay_us);
> >  
> >  static inline bool
> > -__csched_vcpu_is_cache_hot(const struct csched_private *prv,
> > struct vcpu *v)
> > +__csched_vcpu_is_cache_hot(const struct csched_private *prv,
> > +                           struct csched_vcpu * scurr)
> 
> Stray blank, and it looks like the parameter can be pointer to const.
> Similar further down.
> 
And besides this that Jan is saying, I'd name the parameter 'svc'
rather than 'scurr'.

Calling it scurr makes one think that it is always a vcpu that is
currently running on a pcpu which is being passed to the function. But
that, not only is not at all required, but it is not even the case
right now.

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] schedule: move last_run_time to the credit scheduler privates
  2018-09-11  8:10 [PATCH] schedule: move last_run_time to the credit scheduler privates Andrii Anisov
  2018-09-11  8:29 ` Jan Beulich
@ 2018-09-12  8:14 ` Dario Faggioli
  2018-09-12  9:26   ` Andrii Anisov
  1 sibling, 1 reply; 5+ messages in thread
From: Dario Faggioli @ 2018-09-12  8:14 UTC (permalink / raw)
  To: Andrii Anisov, xen-devel
  Cc: Wei Liu, Stefano Stabellini, Andrii Anisov,
	Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper, Tim Deegan,
	Julien Grall, Jan Beulich, xen-devel, Ian Jackson


[-- Attachment #1.1: Type: text/plain, Size: 1020 bytes --]

On Tue, 2018-09-11 at 11:10 +0300, Andrii Anisov wrote:
> From: Andrii Anisov <andrii_anisov@epam.com>
> 
> The structure member last_run_time is used by a credit scheduler
> only.
> So move it from a generic vcpu sctructure to the credit scheduler
> private
> vcpu definition.
> 
> Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
> ---
> 
> index 84e744b..7170172 100644
> --- a/xen/common/sched_credit.c
> +++ b/xen/common/sched_credit.c
> @@ -175,6 +175,9 @@ struct csched_vcpu {
>      atomic_t credit;
>      unsigned int residual;
>  
> +    /* last time when vCPU is scheduled out */
> +    uint64_t last_run_time;
> +
>
I think that, while we're doing this, we should take the chance to
convert the type to s_time_t too.

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] schedule: move last_run_time to the credit scheduler privates
  2018-09-12  8:14 ` Dario Faggioli
@ 2018-09-12  9:26   ` Andrii Anisov
  0 siblings, 0 replies; 5+ messages in thread
From: Andrii Anisov @ 2018-09-12  9:26 UTC (permalink / raw)
  To: Dario Faggioli, Andrii Anisov, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Tim Deegan, Julien Grall,
	Jan Beulich, xen-devel, Ian Jackson

Hello Dario,

On 12.09.18 11:14, Dario Faggioli wrote:
> I think that, while we're doing this, we should take the chance to
> convert the type to s_time_t too.
Good point, as well as renaming scurr.

-- 

*Andrii Anisov*


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-12  9:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11  8:10 [PATCH] schedule: move last_run_time to the credit scheduler privates Andrii Anisov
2018-09-11  8:29 ` Jan Beulich
2018-09-11 16:08   ` Dario Faggioli
2018-09-12  8:14 ` Dario Faggioli
2018-09-12  9:26   ` Andrii Anisov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.