Function report |
Source Code:kernel\sched\core.c |
Create Date:2022-07-28 09:36:28 |
| Last Modify:2022-05-22 13:40:38 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:__sched_setscheduler
Proto:static int __sched_setscheduler(struct task_struct *p, const struct sched_attr *attr, bool user, bool pi)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct task_struct * | p | |
| const struct sched_attr * | attr | |
| bool | user | |
| bool | pi |
| 4771 | oldpolicy = -1 |
| 4772 | policy = sched_policy |
| 4780 | BUG_ON(pi && in_interrupt()) |
| 4781 | recheck : |
| 4783 | If policy < 0 Then |
| 4786 | Else |
| 4787 | reset_on_fork = Not Not (sched_flags & For the sched_{set,get}attr() calls) |
| 4789 | If Not valid_policy(policy) Then Return -EINVAL |
| 4801 | If mm && SCHED_FIFO, SCHED_RR > Maximum user real-time process priority - 1 || Not mm && SCHED_FIFO, SCHED_RR > MAX_RT_PRIO - 1 Then Return -EINVAL |
| 4804 | If dl_policy(policy) && Not __checkparam_dl(attr) || rt_policy(policy) != SCHED_FIFO, SCHED_RR != 0 Then Return -EINVAL |
| 4811 | If user && Not Check operation authority Then |
| 4812 | If fair_policy(policy) Then |
| 4819 | rlim_rtprio = task_rlimit(p, RLIMIT_RTPRIO) |
| 4823 | If policy != policy && Not rlim_rtprio Then Return -EPERM |
| 4827 | If SCHED_FIFO, SCHED_RR > rt_priority && SCHED_FIFO, SCHED_RR > rlim_rtprio Then Return -EPERM |
| 4845 | If task_has_idle_policy(p) && Not idle_policy(policy) Then |
| 4846 | If Not an_nice - check if a task can reduce its nice value*@p: task*@nice: nice value Then Return -EPERM |
| 4851 | If Not Check the target process has a UID that matches the current process's: Then Return -EPERM |
| 4855 | If Scheduler bits, serialized by scheduler locks: && Not reset_on_fork Then Return -EPERM |
| 4859 | If user Then |
| 4863 | retval = security_task_setscheduler(p) |
| 4869 | If sched_flags & SCHED_FLAG_UTIL_CLAMP Then |
| 4875 | If pi Then cpuset_read_lock() |
| 4886 | update_rq_clock(rq) |
| 4900 | If Value for the false possibility is greater at compile time(policy == policy) Then |
| 4901 | If fair_policy(policy) && SCHED_NORMAL, SCHED_BATCH != ask_nice - return the nice value of a given task.*@p: the task in question.* Return: The nice value [ -20 ... 0 ... 19 ]. Then Go to change |
| 4903 | If rt_policy(policy) && SCHED_FIFO, SCHED_RR != rt_priority Then Go to change |
| 4907 | If sched_flags & SCHED_FLAG_UTIL_CLAMP Then Go to change |
| 4911 | retval = 0 |
| 4912 | Go to unlock |
| 4914 | change : |
| 4916 | If user Then If Value for the false possibility is greater at compile time(oldpolicy != - 1 && oldpolicy != policy) Then |
| 4970 | If pi Then |
| 4978 | new_effective_prio = rt_effective_prio(p, newprio) |
| 4979 | If new_effective_prio == oldprio Then queue_flags &= ~Matches ENQUEUE_MOVE |
| 4983 | queued = task_on_rq_queued(p) |
| 4984 | running = task_current(rq, p) |
| 4985 | If queued Then dequeue_task(rq, p, queue_flags) |
| 4987 | If running Then put_prev_task(rq, p) |
| 4990 | prev_class = sched_class |
| 4993 | __setscheduler_uclamp(p, attr) |
| 4995 | If queued Then |
| 5000 | If oldprio < prio Then queue_flags |= ENQUEUE_HEAD |
| 5003 | enqueue_task(rq, p, queue_flags) |
| 5005 | If running Then set_next_task(rq, p) |
| 5012 | task_rq_unlock(rq, p, & rf) |
| 5014 | If pi Then |
| 5015 | cpuset_read_unlock() |
| 5016 | rt_mutex_adjust_pi(p) |
| 5020 | balance_callback(rq) |
| 5021 | preempt_enable() |
| 5023 | Return 0 |
| 5025 | unlock : |
| 5026 | task_rq_unlock(rq, p, & rf) |
| 5027 | If pi Then cpuset_read_unlock() |
| 5029 | Return retval |
| Name | Describe |
|---|---|
| _sched_setscheduler | |
| sched_setattr | |
| sched_setattr_nocheck |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |