Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:mempool_alloc - allocate an element from a specific memory pool*@pool: pointer to the memory pool which was allocated via* mempool_create().*@gfp_mask: the usual allocation bitmask.* this function only sleeps if the alloc_fn() function sleeps or

Proto:void *mempool_alloc(mempool_t *pool, gfp_t gfp_mask)

Type:void

Parameter:

TypeParameterName
mempool_t *pool
gfp_tgfp_mask
382  VM_WARN_ON_ONCE(gfp_mask & __GFP_ZERO)
383  might_sleep_if(gfp_mask & Caller can reclaim )
385  gfp_mask |= __GFP_NOMEMALLOC
386  gfp_mask |= __GFP_NORETRY
387  gfp_mask |= DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.
389  gfp_temp = gfp_mask & ~(Caller can reclaim | DOC: Reclaim modifiers* Reclaim modifiers* ~~~~~~~~~~~~~~~~~* %__GFP_IO can start physical IO.* %__GFP_FS can call down to the low-level FS. Clearing the flag avoids the* allocator recursing into the filesystem which might already be holding* locks.)
391  repeat_alloc :
393  element = alloc(gfp_temp, pool_data)
394  If Value is more likely to compile time(element != NULL) Then Return element
397  spin_lock_irqsave( & lock, flags)
398  If Value is more likely to compile time( Current nr of elements at *elements ) Then
399  element = remove_element(pool)
400  spin_unlock_irqrestore( & lock, flags)
402  smp_wmb()
407  kmemleak_update_trace(element)
408  Return element
415  If gfp_temp != gfp_mask Then
416  spin_unlock_irqrestore( & lock, flags)
417  gfp_temp = gfp_mask
418  Go to repeat_alloc
422  If Not (gfp_mask & Caller can reclaim ) Then
423  spin_unlock_irqrestore( & lock, flags)
424  Return NULL
428  init_wait( & wait)
429  Note: we use "set_current_state()" _after_ the wait-queue add,* because we need a memory barrier there on SMP, so that any* wake-function that tests for the wait-queue being active* will be guaranteed to see waitqueue addition _or_ subsequent
431  spin_unlock_irqrestore( & lock, flags)
437  This task is about to go to sleep on IO. Increment rq->nr_iowait so* that process accounting knows that this is a task in IO wait state.
439  sh_wait - clean up after waiting in a queue*@wq_head: waitqueue waited on*@wq_entry: wait descriptor* Sets current thread back to running state and removes* the wait descriptor from the given waitqueue if still* queued.
440  Go to repeat_alloc
Caller
NameDescribe
sg_pool_alloc
bio_alloc_bioset_alloc_bioset - allocate a bio for I/O*@gfp_mask: the GFP_* mask given to the slab allocator*@nr_iovecs: number of iovecs to pre-allocate*@bs: the bio_set to allocate from
__blk_queue_bounce
bio_integrity_alloc_integrity_alloc - Allocate integrity payload and attach it to bio*@bio: bio to attach integrity metadata to*@gfp_mask: Memory allocation mask*@nr_vecs: Number of integrity metadata scatter-gather elements* Description: This function prepares a bio for
btree_node_alloc