Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:We can potentially split a vm area into separate* areas, each area with its own behavior.

Proto:static long madvise_behavior(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end, int behavior)

Type:long

Parameter:

TypeParameterName
struct vm_area_struct *vma
struct vm_area_struct **prev
unsigned longstart
unsigned longend
intbehavior
69  mm = The address space we belong to.
70  error = 0
72  new_flags = Flags, see mm.h.
75  Case behavior == further special treatment
76  new_flags = new_flags & ~App will not benefit from clustered reads & ~App will access data sequentially
77  Break
78  Case behavior == xpect sequential page references
79  new_flags = new_flags & ~App will not benefit from clustered reads | App will access data sequentially
80  Break
81  Case behavior == xpect random page references
82  new_flags = new_flags & ~App will access data sequentially | App will not benefit from clustered reads
83  Break
84  Case behavior == don't inherit across fork
85  new_flags |= Do not copy this vma on fork
86  Break
87  Case behavior == do inherit across fork
89  error = -EINVAL
90  Go to out
92  new_flags &= ~Do not copy this vma on fork
93  Break
94  Case behavior == Zero memory on fork, child only
97  error = -EINVAL
98  Go to out
100  new_flags |= Wipe VMA contents in child.
101  Break
102  Case behavior == Undo MADV_WIPEONFORK
103  new_flags &= ~Wipe VMA contents in child.
104  Break
105  Case behavior == Explicity exclude from the core dump,overrides the coredump filter bits
106  new_flags |= Do not include in the core dump
107  Break
108  Case behavior == Clear the MADV_DONTDUMP flag
110  error = -EINVAL
111  Go to out
113  new_flags &= ~Do not include in the core dump
114  Break
115  Case behavior == KSM may merge identical pages
116  Case behavior == KSM may not merge identical pages
117  error = ksm_madvise(vma, start, end, behavior, & new_flags)
118  If error Then Go to out_convert_errno
120  Break
121  Case behavior == Worth backing with hugepages
122  Case behavior == Not worth backing with hugepages
123  error = hugepage_madvise(vma, & new_flags, behavior)
124  If error Then Go to out_convert_errno
126  Break
129  If new_flags == Flags, see mm.h. Then
130  prev = vma
131  Go to out
134  pgoff = Offset (within vm_file) in PAGE_SIZEunits + ( start - Our start address within vm_mm. >> PAGE_SHIFT determines the page size )
135  prev = Given a mapping request (addr,end,vm_flags,file,pgoff), figure out* whether that can be merged with its predecessor or its successor
138  If prev Then
139  vma = prev
140  Go to success
143  prev = vma
145  If start != Our start address within vm_mm. Then
147  error = -ENOMEM
148  Go to out
150  error = __split_vma() bypasses sysctl_max_map_count checking. We use this where it* has already been checked or doesn't make sense to fail.
151  If error Then Go to out_convert_errno
155  If end != The first byte after our end addresswithin vm_mm. Then
157  error = -ENOMEM
158  Go to out
160  error = __split_vma() bypasses sysctl_max_map_count checking. We use this where it* has already been checked or doesn't make sense to fail.
161  If error Then Go to out_convert_errno
165  success :
169  Flags, see mm.h. = new_flags
171  out_convert_errno :
176  If error == -ENOMEM Then error = -EAGAIN
178  out :
179  Return error
Caller
NameDescribe
madvise_vma