函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:include\linux\sched\task.h Create Date:2022-07-27 06:41:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring* subscriptions and synchronises with wait4(). Also used in procfs. Also* pins the final release of task.io_context. Also protects ->cpuset and* ->cgroup.subsys[]. And ->vfork_done.

函数原型:static inline void task_lock(struct task_struct *p)

返回类型:void

参数:

类型参数名称
struct task_struct *p
171  加自旋锁
调用者
名称描述
get_task_exe_fileget_task_exe_file - acquire a reference to the task's executable file* Returns %NULL if task's mm (if any) has no associated executable file or* this is a kernel thread with borrowed mm (see the comment above get_task_mm).
get_task_mmget_task_mm - acquire a reference to the task's mm* Returns %NULL if the task has no mm. Checks PF_KTHREAD (meaning* this kernel workthread has transiently adopted a user mm with use_mm,* to do its AIO) is not set and if so returns a reference to it, after
complete_vfork_done
wait_for_vfork_done
copy_signal复制信号
ksys_unshareshare allows a process to 'unshare' part of the process* context which was originally shared using clone. copy_** functions used by do_fork() cannot be used here directly* because they modify an inactive task_struct that is being* constructed
unshare_filesHelper to unshare the files of the current task.* We don't want to expose copy_files internals to* the exec layer of the kernel.
mm_update_next_ownerA task is exiting. If it owned this mm, find a new owner for the mm.
exit_mmTurn us into a lazy TLB process if we* aren't already..
ptrace_may_access
ptrace_attach
SYSCALL_DEFINE2Back compatibility for getrlimit. Needed for some apps.
COMPAT_SYSCALL_DEFINE2
do_prlimitmake sure you are allowed to change @tsk limits before calling this
prctl_set_auxv
switch_task_namespaces
get_file_raw_ptrThe caller must have pinned the task
cgroupns_get
cpuset_change_task_nodemaskpuset_change_task_nodemask - change task's mems_allowed and mempolicy*@tsk: the task to change*@newmems: new nodes that the task will be set* We use the mems_allowed_seq seqlock to safely update both tsk->mems_allowed
utsns_get
pidns_for_children_get
find_lock_task_mmThe process p may have detached its own ->mm while exiting or through* use_mm(), but one or more of its subthreads may still have a valid* pointer. Return p, or any of its subthreads with a valid ->mm, with* task_lock() held.
oom_kill_process
use_mmse_mm* Makes the calling kernel thread take on the specified* mm context.* (Note: this routine is intended to be called only* from a kernel thread context)
unuse_mmse_mm* Reverses the effect of use_mm, i.e. releases the* specified mm context which was earlier taken on* by the calling kernel thread* (Note: this routine is intended to be called only* from a kernel thread context)
do_set_mempolicySet the process memory policy
do_get_mempolicyRetrieve NUMA policy
do_mbind
init_nodemask_of_mempolicy_nodemask_of_mempolicy* If the current task's mempolicy is "default" [NULL], return 'false'* to indicate default policy
mempolicy_nodemask_intersectsmempolicy_nodemask_intersects* If tsk's mempolicy is "default" [NULL], return 'true' to indicate default* policy. Otherwise, check for intersection between mask and the policy* nodemask for 'bind' or 'interleave' policy. For 'perferred' or 'local'
__mpol_dupSlow path of a mempolicy duplicate
mpol_put_task_policyDrop the (possibly final) reference to task->mempolicy. It needs to be* dropped after task->mempolicy is set to NULL so that any allocation done as* part of its kmem_cache_free(), such as by KASAN, doesn't reference a freed* policy.
mpol_shared_policy_initmpol_shared_policy_init - initialize shared policy for inode*@sp: pointer to inode shared policy*@mpol: struct mempolicy to install* Install non-NULL @mpol in inode's shared policy rb-tree.* On entry, the current task has a reference on a non-NULL @mpol.
ipcns_get
exit_io_contextCalled by the exiting task
create_task_io_context
get_task_io_contextget_task_io_context - get io_context of a task*@task: task of interest*@gfp_flags: allocation flags, used if allocation is necessary*@node: allocation node, used if allocation is necessary* Return io_context of @task
get_task_ioprio
blkcg_can_attachWe cannot support shared io contexts, as we have no mean to support* two tasks with the same ioc in two different groups without major rework* of the main cic data structures. For now we allow a task to change
selinux_bprm_committing_credsPrepare a process for imminent new credential changes due to exec
yama_ptrace_tracemeyama_ptrace_traceme - validate PTRACE_TRACEME calls*@parent: task that will become the ptracer of the current task* Returns 0 if following the ptrace is allowed, -ve on error.
bprm_mm_initCreate a new mm_struct and populate it with a temporary stack* vm_area_struct. We don't have enough context at this point to set the stack* flags, permissions, and offset, so we use temporary values. We'll update* them later in setup_arg_pages().
exec_mmap
__get_task_comm
__set_task_commThese functions flushes out all traces of the currently running executable* so that a new one can be started
finalize_execRuns immediately before start_thread() takes over.
get_files_struct
reset_files_struct
exit_files
mntns_get
chroot_fs_refs
exit_fs
unshare_fs_struct
mounts_open_common
__io_worker_unuseNote: drops the wqe->lock if returning true! The caller must re-acquire* the lock in that case. Some callers need to restart handling if this* happens, so we can't just re-acquire the lock on behalf of the caller.
io_worker_handle_work
do_coredump