Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sched\psi.c Create Date:2022-07-28 09:46:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:psi_trigger_create

Proto:struct *psi_trigger_create(struct psi_group *group, char *buf, size_t nbytes, enum psi_res res)

Type:struct

Parameter:

TypeParameterName
struct psi_group *group
char *buf
size_tnbytes
enum psi_resres
1015  If static_branch_likely( & psi_disabled) Then Return ERR_PTR( - EOPNOTSUPP)
1018  If sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments == 2 Then state = PSI_IO_SOME + res * 2
1020  Else if sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments == 2 Then state = PSI_IO_FULL + res * 2
1022  Else Return ERR_PTR( - EINVAL)
1025  If state >= PSI_NONIDLE Then Return ERR_PTR( - EINVAL)
1028  If window_us < Min window size is 500ms || window_us > Max window size is 10s Then Return ERR_PTR( - EINVAL)
1033  If threshold_us == 0 || threshold_us > window_us Then Return ERR_PTR( - EINVAL)
1036  t = Allocation memory
1037  If Not t Then Return ERR_PTR( - ENOMEM)
1040  group = group
1041  state = state
1042  threshold = threshold_us * NSEC_PER_USEC
1043  size = window_us * NSEC_PER_USEC
1044  Trigger tracking window manupulations
1046  event = 0
1047  last_event_time = 0
1048  init_waitqueue_head( & event_wait)
1049  kref_init - initialize object.*@kref: object in question.
1051  mutex_lock( & trigger_lock)
1053  If Not cu_access_pointer() - fetch RCU pointer with no dereferencing*@p: The pointer to read* Return the value of the specified RCU-protected pointer, but omit the* lockdep checks for being in an RCU read-side critical section(poll_kworker) Then
1054  struct sched_param param = {sched_priority = 1, }
1059  kworker = kthread_create_worker - create a kthread worker*@flags: flags modifying the default behavior of the worker*@namefmt: printf-style name for the kthread worker (task)
1060  If IS_ERR(kworker) Then
1065  sched_setscheduler_nocheck - change the scheduling policy and/or RT priority of a thread from kernelspace
1066  kthread_init_delayed_work( & poll_work, psi_poll_work)
1068  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization(poll_kworker, kworker)
1071  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
1072  poll_min_period = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(poll_min_period, div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full )
1074  nr_triggers[state]++
1075  poll_states |= 1 << state
1077  mutex_unlock( & trigger_lock)
1079  Return t
Caller
NameDescribe
psi_write