Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:vb_alloc

Proto:static void *vb_alloc(unsigned long size, gfp_t gfp_mask)

Type:void

Parameter:

TypeParameterName
unsigned longsize
gfp_tgfp_mask
1610  void * vaddr = NULL
1613  BUG_ON(offset_in_page(size))
1614  BUG_ON(size > PAGE_SIZE * 256K with 4K pages )
1615  If WARN_ON(size == 0) Then
1621  Return NULL
1623  order = get_order - Determine the allocation order of a memory size*@size: The size for which to get the order* Determine the allocation order of a particular sized block of memory
1625  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1626  vbq = Must be an lvalue. Since @var must be a simple identifier,* we force a syntax error here if it isn't.(Queue of free and dirty vmap blocks, for allocation and flushing purposes )
1630  spin_lock( & lock)
1631  If free < 1UL << order Then
1632  spin_unlock( & lock)
1633  Continue
1636  pages_off = VMAP_BBMAP_BITS - free
1637  vaddr = vmap_block_vaddr(va_start, pages_off)
1638  free -= 1UL << order
1639  If free == 0 Then
1640  spin_lock( & lock)
1641  list_del_rcu - deletes entry from list without re-initialization*@entry: the element to delete from the list
1642  spin_unlock( & lock)
1645  spin_unlock( & lock)
1646  Break
1649  The weird & is necessary because sparse considers (void)(var) to be* a direct dereference of percpu variable (var).(Queue of free and dirty vmap blocks, for allocation and flushing purposes )
1650  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1653  If Not vaddr Then vaddr = w_vmap_block - allocates new vmap_block and occupies 2^order pages in this* block
1656  Return vaddr
Caller
NameDescribe
vm_map_ramvm_map_ram - map pages linearly into kernel virtual address (vmalloc space)*@pages: an array of pointers to the pages to be mapped*@count: number of pages*@node: prefer to allocate data structures on this node*@prot: memory protection to use