Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\io_uring.c Create Date:2022-07-28 20:22:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:io_ring_ctx_alloc

Proto:static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)

Type:struct io_ring_ctx

Parameter:

TypeParameterName
struct io_uring_params *p
505  ctx = 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).
506  If Not ctx Then Return NULL
509  if all else fails... = kmem_cache_alloc(req_cachep, GFP_KERNEL)
510  If Not if all else fails... Then Go to err
513  0 is for ctx quiesce/reinit/free, 1 is for sqo_thread started = Allocation memory
514  If Not 0 is for ctx quiesce/reinit/free, 1 is for sqo_thread started Then Go to err
521  hash_bits = log2 - log base 2 of 32-bit or a 64-bit unsigned value*@n: parameter* constant-capable log of base 2 calculation* - this can be used to initialise global variables from constant data, hence* the massive ternary operator construction* selects the (cq_entries)
522  hash_bits -= 5
523  If hash_bits <= 0 Then hash_bits = 1
525  cancel_hash_bits = hash_bits
526  cancel_hash = Allocation memory
528  If Not cancel_hash Then Go to err
530  __hash_init(cancel_hash, 1U << hash_bits)
532  If percpu_ref_init - initialize a percpu refcount*@ref: percpu_ref to initialize*@release: function which will be called when refcount hits 0*@flags: PERCPU_REF_INIT_* flags*@gfp: allocation mask to use* Initializes @ref Then Go to err
536  flags = flags
537  init_waitqueue_head( & cq_wait)
538  Initialization list head
539  init_completion( & 0 is for ctx quiesce/reinit/free, 1 is for sqo_thread started [0])
540  init_completion( & 0 is for ctx quiesce/reinit/free, 1 is for sqo_thread started [1])
541  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & uring_lock)
542  init_waitqueue_head( & wait)
543  Process spin lock initialization( & completion_lock)
544  Initialization list head
545  Initialization list head
546  Initialization list head
547  init_waitqueue_head( & inflight_wait)
548  Process spin lock initialization( & inflight_lock)
549  Initialization list head
550  Return ctx
551  err :
552  If if all else fails... Then kmem_cache_free(req_cachep, if all else fails... )
554  kfree( 0 is for ctx quiesce/reinit/free, 1 is for sqo_thread started )
555  kfree(cancel_hash)
556  kfree(ctx)
557  Return NULL
Caller
NameDescribe
io_uring_create