schedule: move credit scheduler specific member to its privates
authorAndrii Anisov <andrii_anisov@epam.com>
Wed, 12 Jun 2019 09:35:50 +0000 (12:35 +0300)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 12 Jun 2019 11:27:45 +0000 (12:27 +0100)
commit608639ffa0a0d6f219e14ba7397ab2cc018b93c9
tree79af6b27a4912bb2a1ebf8d4258f0d9fbe4b07ff
parent480800c76969b38f13b6909eb679b23571417538
schedule: move credit scheduler specific member to its privates

The vcpu structure member last_run_time is used by credit scheduler only.
In order to get better encapsulation, it is moved from a generic
structure to the credit scheduler private vcpu definition. Also, rename
the member to last_sched_time in order to reflect that it is the time
when the vcpu went through the scheduling path.

With this move we have slight changes in functionality:
 - last_sched_time is not updated for an idle vcpu. But the idle vcpu is,
   in fact, a per-pcpu stub and never migrates so last_sched_time is
   meaningless for it.
 - The value of last_sched_time is updated on every schedule, even if the
   vcpu is not being changed. It is still ok, because last_sched_time is
   only used for runnable vcpu migration decision, and we have it correct
   at that moment. Scheduling parameters and statistics are tracked by
   other entities.

Reducing code and data usage when not running credit scheduler is another
nice side effect.

While here, also:
  - turn last_sched_time into s_time_t, which is more appropriate.
  - properly const-ify related argument of __csched_vcpu_is_cache_hot().

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
xen/common/sched_credit.c
xen/common/schedule.c
xen/include/xen/sched.h