函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sched\core.c Create Date:2022-07-27 10:37:04
Last Modify:2022-05-22 13:40:38 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__sched_setscheduler

函数原型:static int __sched_setscheduler(struct task_struct *p, const struct sched_attr *attr, bool user, bool pi)

返回类型:int

参数:

类型参数名称
struct task_struct *p
const struct sched_attr *attr
booluser
boolpi
4769  newprio等于如果dl_policy(sched_policy)则SCHED_DEADLINE tasks has negative priorities, reflecting* the fact that any of them has higher prio than RT and* NORMAL/BATCH tasks.减1否则MAX_RT_PRIO减1减SCHED_FIFO, SCHED_RR
4771  oldpolicy等于负1
4772  policy等于sched_policy
4776  queue_flags等于Matches ENQUEUE_RESTORE 按位或Matches ENQUEUE_MOVE 按位或Matches ENQUEUE_NOCLOCK
4780  BUG_ON(pi && in_interrupt())
4781  recheck :
4783  如果policy小于0则
4784  reset_on_fork等于 Scheduler bits, serialized by scheduler locks:
4785  policy等于oldpolicy等于任务调度策略
4786  否则
4787  reset_on_fork等于非非sched_flags按位与For the sched_{set,get}attr() calls的值
4789  如果非valid_policy(policy)则返回:负EINVAL
4793  如果sched_flags按位与SCHED_FLAG_ALL按位或!! For sched_setattr_nocheck() (kernel) only !!* This is actually gross. :(* It is used to make schedutil kworker(s) higher priority than SCHED_DEADLINE* tasks, but still be able to sleep. We need this on platforms that cannot的值的反则返回:负EINVAL
4801  如果内存信息SCHED_FIFO, SCHED_RR 大于Priority of a process goes from 0减1或非内存信息SCHED_FIFO, SCHED_RR 大于MAX_RT_PRIO减1则返回:负EINVAL
4804  如果dl_policy(policy)且非__checkparam_dl(attr)或rt_policy(policy)不等于SCHED_FIFO, SCHED_RR 不等于0则返回:负EINVAL
4811  如果user且非操作权限检查
4812  如果fair_policy(policy)则
4818  如果rt_policy(policy)则
4823  如果policy不等于任务调度策略且非rlim_rtprio则返回:负EPERM
4838  如果dl_policy(policy)则返回:负EPERM
4845  如果task_has_idle_policy(p)且非idle_policy(policy)则
4851  如果非Check the target process has a UID that matches the current process's:则返回:负EPERM
4855  如果 Scheduler bits, serialized by scheduler locks: 且非reset_on_fork则返回:负EPERM
4859  如果user
4860  如果sched_flags按位与!! For sched_setattr_nocheck() (kernel) only !!* This is actually gross. :(* It is used to make schedutil kworker(s) higher priority than SCHED_DEADLINE* tasks, but still be able to sleep. We need this on platforms that cannot则返回:负EINVAL
4863  retval等于security_task_setscheduler(p)
4864  如果retval则返回:retval
4869  如果sched_flags按位与SCHED_FLAG_UTIL_CLAMP
4870  retval等于uclamp_validate(p, attr)
4871  如果retval则返回:retval
4875  如果picpuset_read_lock()
4885  rq等于ask_rq_lock - lock p->pi_lock and lock the rq @p resides on.
4886  更新rq运行时间
4891  如果p恒等于停止任务
4892  retval等于负EINVAL
4893  转到:unlock
4900  如果此条件成立可能性小(为编译器优化)(policy == 任务调度策略)则
4901  如果fair_policy(policy)且SCHED_NORMAL, SCHED_BATCH 不等于返回给定任务的值则转到:change
4903  如果rt_policy(policy)且SCHED_FIFO, SCHED_RR 不等于实时任务优先级则转到:change
4905  如果dl_policy(policy)且dl_param_changed(p, attr)则转到:change
4907  如果sched_flags按位与SCHED_FLAG_UTIL_CLAMP则转到:change
4910  Scheduler bits, serialized by scheduler locks: 等于reset_on_fork
4911  retval等于0
4912  转到:unlock
4914  change :
4916  如果user则如果此条件成立可能性小(为编译器优化)(oldpolicy != - 1 && oldpolicy != 任务调度策略)则
4950  policy等于oldpolicy等于负1
4951  task_rq_unlock(rq, p, & rf)
4952  如果picpuset_read_unlock()
4954  转到:recheck
4962  如果dl_policy(policy)或dl_task(p)的值且We must be sure that accepting a new task (or allowing changing the* parameters of an existing one) is consistent with the bandwidth* constraints. If yes, this function also accordingly updates the currently
4963  retval等于负EBUSY
4964  转到:unlock
4967  Scheduler bits, serialized by scheduler locks: 等于reset_on_fork
4968  oldprio等于prio
4970  如果pi
4978  new_effective_prio等于rt_effective_prio(p, newprio)
4979  如果new_effective_prio恒等于oldprioqueue_flags与等于Matches ENQUEUE_MOVE 的反
4983  queued等于进程处于任务队列
4984  running等于task_current(rq, p)
4985  如果queueddequeue_task(rq, p, queue_flags)
4987  如果runningput_prev_task(rq, p)
4990  prev_class等于调度函数
4992  Actually do priority change: must hold pi & rq lock.
4993  __setscheduler_uclamp(p, attr)
4995  如果queued
5000  如果oldprio小于prioqueue_flags或等于ENQUEUE_HEAD
5003  enqueue_task(rq, p, queue_flags)
5005  如果runningset_next_task(rq, p)
5008  switched_from, switched_to and prio_changed must _NOT_ drop rq->lock,* use the balance_callback list if you want balancing.* this means any call to check_class_changed() must be followed by a call to* balance_callback().
5011  禁止抢占()
5012  task_rq_unlock(rq, p, & rf)
5014  如果pi
5015  cpuset_read_unlock()
5016  rt_mutex_adjust_pi(p)
5020  负载均衡配置
5021  禁用抢占和中断()
5023  返回:0
5025  unlock :
5026  task_rq_unlock(rq, p, & rf)
5027  如果picpuset_read_unlock()
5029  返回:retval
调用者
名称描述
_sched_setscheduler
sched_setattr
sched_setattr_nocheck