Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sched\core.c Create Date:2022-07-28 09:36:59
Last Modify:2022-05-22 13:40:38 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:yield_to - yield the current processor to another thread in* your thread group, or accelerate that thread toward the* processor it's on

Proto:int __sched yield_to(struct task_struct *p, bool preempt)

Type:int

Parameter:

TypeParameterName
struct task_struct *p
boolpreempt
5710  curr = current process
5713  yielded = 0
5715  local_irq_save(flags)
5716  rq = this_rq()
5718  again :
5719  p_rq = task_rq(p)
5724  If * nr_running and cpu_load should be in the same cacheline because * remote CPUs use both these fields when doing load calculation. == 1 && * nr_running and cpu_load should be in the same cacheline because * remote CPUs use both these fields when doing load calculation. == 1 Then
5725  yielded = -ESRCH
5726  Go to out_irq
5729  double_rq_lock - safely lock two runqueues* Note this does not disable interrupts like task_rq_lock,* you need to do so manually before calling.
5730  If task_rq(p) != p_rq Then
5731  double_rq_unlock - safely unlock two runqueues* Note this does not restore interrupts like task_rq_unlock,* you need to do so manually after calling.
5732  Go to again
5735  If Not yield_to_task Then Go to out_unlock
5738  If sched_class != sched_class Then Go to out_unlock
5741  If task_running(p_rq, p) || run state Then Go to out_unlock
5744  yielded = yield_to_task(rq, p, preempt)
5745  If yielded Then
5746  schedstat_inc(yld_count)
5751  If preempt && rq != p_rq Then sched_curr - mark rq's current task 'to be rescheduled now'.* On UP this means the setting of the need_resched flag, on SMP it* might also involve a cross-CPU call to trigger the scheduler on* the target CPU.
5755  out_unlock :
5756  double_rq_unlock - safely unlock two runqueues* Note this does not restore interrupts like task_rq_unlock,* you need to do so manually after calling.
5757  out_irq :
5758  local_irq_restore(flags)
5760  If yielded > 0 Then schedule()
5763  Return yielded