Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__anon_vma_prepare - attach an anon_vma to a memory region*@vma: the memory region in question* This makes sure the memory mapping described by 'vma' has* an 'anon_vma' attached to it, so that we can associate the

Proto:int __anon_vma_prepare(struct vm_area_struct *vma)

Type:int

Parameter:

TypeParameterName
struct vm_area_struct *vma
178  mm = The address space we belong to.
182  might_sleep()
184  avc = anon_vma_chain_alloc(GFP_KERNEL)
185  If Not avc Then Go to out_enomem
188  anon_vma = d_mergeable_anon_vma is used by anon_vma_prepare, to check* neighbouring vmas for a suitable anon_vma, before it goes off* to allocate a new anon_vma
189  allocated = NULL
190  If Not anon_vma Then
191  anon_vma = anon_vma_alloc()
192  If Value for the false possibility is greater at compile time(!anon_vma) Then Go to out_enomem_free_avc
194  allocated = anon_vma
197  anon_vma_lock_write(anon_vma)
199  spin_lock( & Protects page tables and some * counters)
200  If Value is more likely to compile time(!Serialized by page_table_lock ) Then
201  Serialized by page_table_lock = anon_vma
202  anon_vma_chain_link(vma, avc, anon_vma)
204  Count of child anon_vmas and VMAs which points to this anon_vma.* This counter is used for making decision about reusing anon_vma* instead of forking new one. See comments in function anon_vma_clone.++
205  allocated = NULL
206  avc = NULL
208  spin_unlock( & Protects page tables and some * counters)
209  anon_vma_unlock_write(anon_vma)
211  If Value for the false possibility is greater at compile time(allocated) Then put_anon_vma(allocated)
213  If Value for the false possibility is greater at compile time(avc) Then anon_vma_chain_free(avc)
216  Return 0
218  out_enomem_free_avc :
219  anon_vma_chain_free(avc)
220  out_enomem :
221  Return -ENOMEM
Caller
NameDescribe
anon_vma_prepare