Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:sched_setaffinity

Proto:long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)

Type:long

Parameter:

TypeParameterName
pid_tpid
const struct cpumask *in_mask
5406  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
5408  p = d_process_by_pid - find a process with a matching PID value.*@pid: the pid in question.* The task of @pid, if found. %NULL otherwise.
5409  If Not p Then
5410  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
5411  Return -ESRCH
5415  get_task_struct(p)
5416  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
5418  If Per task flags (PF_*), defined further below: & Userland is not allowed to meddle with cpus_mask Then
5419  retval = -EINVAL
5420  Go to out_put_task
5422  If Not alloc_cpumask_var( & cpus_allowed, GFP_KERNEL) Then
5423  retval = -ENOMEM
5424  Go to out_put_task
5426  If Not alloc_cpumask_var( & new_mask, GFP_KERNEL) Then
5427  retval = -ENOMEM
5428  Go to out_free_cpus_allowed
5430  retval = -EPERM
5431  If Not Check the target process has a UID that matches the current process's: Then
5432  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
5435  Go to out_free_new_mask
5437  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
5440  retval = security_task_setscheduler(p)
5441  If retval Then Go to out_free_new_mask
5445  cpuset_cpus_allowed(p, cpus_allowed)
5446  pumask_and - *dstp = *src1p & *src2p*@dstp: the cpumask result*@src1p: the first input*@src2p: the second input* If *@dstp is empty, returns 0, else returns 1
5465  again :
5466  retval = __set_cpus_allowed_ptr(p, new_mask, true)
5468  If Not retval Then
5469  cpuset_cpus_allowed(p, cpus_allowed)
5477  Go to again
5480  out_free_new_mask :
5481  free_cpumask_var(new_mask)
5482  out_free_cpus_allowed :
5483  free_cpumask_var(cpus_allowed)
5484  out_put_task :
5485  put_task_struct(p)
5486  Return retval
Caller
NameDescribe
SYSCALL_DEFINE3sys_sched_setaffinity - set the CPU affinity of a process*@pid: pid of the process*@len: length in bytes of the bitmask pointed to by user_mask_ptr*@user_mask_ptr: user-space pointer to the new CPU mask* Return: 0 on success. An error code otherwise.
rcutorture_sched_setaffinityGet rcutorture access to sched_setaffinity().
COMPAT_SYSCALL_DEFINE3
move_to_next_cpu
start_kthreadstart_kthread - Kick off the hardware latency sampling/detector kthread* This starts the kernel thread that will sit and sample the CPU timestamp* counter (TSC or similar) and look for potential hardware latencies.