Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:kthread

Proto:static int kthread(void *_create)

Type:int

Parameter:

TypeParameterName
void *_create
217  create = _create
218  int( * threadfn)(void * data) = threadfn
219  data = data
224  self = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
225  set_kthread_struct(self)
228  done = xchg( & done, NULL)
229  If Not done Then
230  free previously allocated memory
231  do_exit( - EINTR)
234  If Not self Then
235  Result passed back to kthread_create() from kthreadd. = ERR_PTR( - ENOMEM)
236  complete(done)
237  do_exit( - ENOMEM)
240  data = data
241  init_completion( & exited)
242  init_completion( & parked)
243  vfork_done = exited
246  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (TASK_UNINTERRUPTIBLE)
247  Result passed back to kthread_create() from kthreadd. = current process
248  complete(done)
249  schedule()
251  ret = -EINTR
252  If Not st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from Then
253  cgroup_kthread_ready()
254  __kthread_parkme(self)
255  ret = threadfn(data)
257  do_exit(ret)