Skip to content

Commit 6a144e6

Browse files
Shuo A Liuwenlingz
authored andcommitted
hv: sched: add yield support
Add yield support for schedule, which can give up pcpu proactively. Tracked-On: #4178 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>
1 parent 6554437 commit 6a144e6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

hypervisor/common/schedule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ void kick_thread(const struct thread_object *obj)
240240
release_schedule_lock(pcpu_id, rflag);
241241
}
242242

243+
void yield_current(void)
244+
{
245+
make_reschedule_request(get_pcpu_id(), DEL_MODE_IPI);
246+
}
247+
243248
void run_thread(struct thread_object *obj)
244249
{
245250
uint64_t rflag;

hypervisor/include/common/schedule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void run_thread(struct thread_object *obj);
109109
void sleep_thread(struct thread_object *obj);
110110
void wake_thread(struct thread_object *obj);
111111
void kick_thread(const struct thread_object *obj);
112+
void yield_current(void);
112113
void schedule(void);
113114

114115
void arch_switch_to(void *prev_sp, void *next_sp);

0 commit comments

Comments
 (0)