Vm_stat_account
void Vm_stat_account (struct mm_struct *mm, vm_flags_t flags, long npages)
{
MM->TOTAL_VM + = Npages;
if (is_exec_mapping (Flags))
MM->EXEC_VM + = Npages;
else if (is_stack_mapping (Flags))
MM->STACK_VM + = Npages;
else if (is_data_mapping (Flags))
MM->DATA_VM + = Npages;
}
Initially, these pages are either anonymous or file pages
239/*
240 * Executable code area-executable, not writable, not stack
241 */
242 static inline B Ool is_exec_mapping (vm_flags_t flags)--This is the file page
243 {
244 return (Flags & VM_ EXEC | Vm_write | Vm_stack)) = = Vm_exec;
245}
246
247/*  
248 * Stack area-atomatically grows in one Direction
249 *  
250&nbs P * Vm_growsup/vm_growsdown VMAs is always private anonymous:
251 * DO_MMAP () forbids all other COMBINATIONS.
252 */
253 static inline bool Is_stack_mapping (vm_flags_t Flags)---Anonymous page
254 {
255 & nbsp Return (Flags & vm_stack) = = Vm_stack;
256}
257
258/*
259 * Data area-private, writable, not stack
260 */
261 static inline bool Is_da Ta_mapping (vm_flags_t Flags)---Anonymous page
262 {
263 return (Flags & (Vm_write | vm_shared | Vm_stack)) = = Vm_write;
264}
Memory usage of the process