zoukankan      html  css  js  c++  java
  • 进程的内存使用

    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 }

  • 相关阅读:
    luogu P3398 仓鼠找sugar
    关于lca
    luogu P3374 【模板】树状数组 1
    [NOIp2013普及组]车站分级
    [HDU1598]find the most comfortable road
    [NOI2015]程序自动分析
    [USACO08DEC]Secret Message
    [洛谷3375]【模板】KMP字符串匹配
    [ZJOI2010]网络扩容
    [SCOI2007]修车
  • 原文地址:https://www.cnblogs.com/honpey/p/8948327.html
Copyright © 2011-2022 走看看