• 进程的内存使用


    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;
    }

    最初这些page都是匿名页或者是文件页

    239 /*
    240  * Executable code area - executable, not writable, not stack
    241  */
    242 static inline bool is_exec_mapping(vm_flags_t flags) ---- 这里使用的是文件页
    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  * VM_GROWSUP / VM_GROWSDOWN VMAs are always private anonymous:
    251  * do_mmap() forbids all other combinations.
    252  */
    253 static inline bool is_stack_mapping(vm_flags_t flags) ---- 匿名页
    254 {
    255     return (flags & VM_STACK) == VM_STACK;
    256 }
    257
    258 /*
    259  * Data area - private, writable, not stack
    260  */
    261 static inline bool is_data_mapping(vm_flags_t flags)  ---- 匿名页
    262 {
    263     return (flags & (VM_WRITE | VM_SHARED | VM_STACK)) == VM_WRITE;
    264 }

  • 相关阅读:
    修改 dll
    SQLServer中char、varchar、nchar、nvarchar的区别:
    关于破解的一点心得
    asp.net 操作XML
    jquery autocomplete
    【转】height,posHeight和pixelHeight区别
    异常处理 Access to the path is denied
    asp.net 获得客户端 mac 地址
    cmd 跟踪路由
    Excel 宏
  • 原文地址:https://www.cnblogs.com/honpey/p/8948327.html
Copyright © 2020-2023  润新知