| Function report | 
| 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 activity | Download SCCT | Chinese | 
Name:sched_setaffinity
Proto:long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
Type:long
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| pid_t | pid | |
| const struct cpumask * | in_mask | 
| 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 | 
| 5411 | Return -ESRCH | 
| 5415 | get_task_struct(p) | 
| 5420 | Go to out_put_task | 
| 5422 | If Not alloc_cpumask_var( & cpus_allowed, GFP_KERNEL) Then | 
| 5424 | Go to out_put_task | 
| 5426 | If Not alloc_cpumask_var( & new_mask, GFP_KERNEL) Then | 
| 5428 | Go to out_free_cpus_allowed | 
| 5433 | If Not ns_capable(user_ns, Allow setting cpu affinity on other processes ) Then | 
| 5435 | Go to out_free_new_mask | 
| 5440 | retval = security_task_setscheduler(p) | 
| 5441 | If retval Then Go to out_free_new_mask | 
| 5445 | cpuset_cpus_allowed(p, cpus_allowed) | 
| 5465 | again : | 
| 5466 | retval = __set_cpus_allowed_ptr(p, new_mask, true) | 
| 5468 | If Not retval Then | 
| 5469 | cpuset_cpus_allowed(p, cpus_allowed) | 
| 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 | 
| Name | Describe | 
|---|---|
| SYSCALL_DEFINE3 | sys_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_setaffinity | Get rcutorture access to sched_setaffinity(). | 
| COMPAT_SYSCALL_DEFINE3 | |
| move_to_next_cpu | |
| start_kthread | start_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. | 
| 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 |