hv: sched: remove runqueue from current schedule logic

Currently we are using a 1:1 mapping logic for pcpu:vcpu. So don't need
a runqueue for it. Removing it as preparation work to abstract scheduler
framework.

Tracked-On: #3813
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Signed-off-by: Yu Wang <yu1.wang@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shuo A Liu
2019-10-14 16:28:19 +08:00
committed by ACRN System Integration
parent 837e4d8788
commit de157ab96c
3 changed files with 16 additions and 26 deletions

View File

@@ -23,7 +23,6 @@ void init_scheduler(void)
ctl = &per_cpu(sched_ctl, i);
spinlock_init(&ctl->scheduler_lock);
INIT_LIST_HEAD(&ctl->runqueue);
ctl->flags = 0UL;
ctl->curr_obj = NULL;
}
@@ -41,31 +40,23 @@ void release_schedule_lock(uint16_t pcpu_id)
spinlock_release(&ctl->scheduler_lock);
}
void add_to_cpu_runqueue(struct thread_object *obj, uint16_t pcpu_id)
void insert_thread_obj(struct thread_object *obj, uint16_t pcpu_id)
{
struct sched_control *ctl = &per_cpu(sched_ctl, pcpu_id);
if (list_empty(&obj->run_list)) {
list_add_tail(&obj->run_list, &ctl->runqueue);
}
ctl->thread_obj = obj;
}
void remove_from_cpu_runqueue(struct thread_object *obj)
void remove_thread_obj(__unused struct thread_object *obj, uint16_t pcpu_id)
{
list_del_init(&obj->run_list);
struct sched_control *ctl = &per_cpu(sched_ctl, pcpu_id);
ctl->thread_obj = NULL;
}
static struct thread_object *get_next_sched_obj(struct sched_control *ctl)
static struct thread_object *get_next_sched_obj(const struct sched_control *ctl)
{
struct thread_object *obj = NULL;
if (!list_empty(&ctl->runqueue)) {
obj = get_first_item(&ctl->runqueue, struct thread_object, run_list);
} else {
obj = &get_cpu_var(idle);
}
return obj;
return ctl->thread_obj == NULL ? &get_cpu_var(idle) : ctl->thread_obj;
}
/**