基于msm-5.4
一、vm_zone_stat[]
基础调用路径:
clear_page_mlock //mlock.c 传参 (.., NR_MLOCK, ..) mlock_vma_page //mlock.c 传参 (.., NR_MLOCK, ..) account_kernel_stack //fork.c 传参 (.., NR_KERNEL_STACK_KB, ..) scs_account //scs.c 传参 (.., NR_KERNEL_SCS_BYTES, ..) mod_zone_page_state //vmstat.h __mod_zone_freepage_state //vmstat.h 传参: (zone, NR_FREE_PAGES, nr_pages) __mod_zone_freepage_state //vmstat.h 传参: (zone, NR_FREE_CMA_PAGES, nr_pages) munlock_vma_page //mlock.c 传参: (page_zone(page), NR_MLOCK, -nr_pages) __munlock_pagevec //mlock.c 传参: (zone, NR_MLOCK, delta_munlocked) rmqueue_bulk //page_alloc.c 传参: (zone, NR_FREE_CMA_PAGES, -(1 << order)) rmqueue_bulk //page_alloc.c 传参: (zone, NR_FREE_PAGES, -(i << order)) __lru_cache_add_active_or_unevictable //swap.c 传参: (.., NR_MLOCK, ..) mlock_migrate_page //mm/internal.h 传参: (page_zone(page), NR_MLOCK, -nr_pages) mlock_migrate_page //mm/internal.h 传参: (page_zone(newpage), NR_MLOCK, nr_pages) __update_lru_size //mm_inline.h 传参: (.., NR_ZONE_LRU_BASE, ..) __mod_zone_page_state //vmstat.c __inc_zone_state //vmstat.c __dec_zone_state //vmstat.c 见其它路径 mod_zone_state //vmstat.c zone_page_state_add //vmstat.h //可能不是这里 atomic_long_add(x, &vm_zone_stat[item]); account_page_cleaned //page-writeback.c 传参: (page, NR_ZONE_WRITE_PENDING) clear_page_dirty_for_io //page-writeback.c 传参: (page, NR_ZONE_WRITE_PENDING) test_clear_page_writeback //page-writeback.c 传参: (page, NR_ZONE_WRITE_PENDING) __free_zspage //zsmalloc.c 传参:(page, NR_ZSPAGES) alloc_zspage //zsmalloc.c 传参:(pages[i], NR_ZSPAGES) zs_page_migrate //zsmalloc.c 传参:(page, NR_ZSPAGES) bounce_end_io //block/bounce.c 传参:(bvec->bv_page, NR_BOUNCE) CONFIG_BOUNCE 默认不使能 pgtable_pte_page_dtor //linux/mm.h 传参:(page, NR_PAGETABLE) dec_zone_page_state //vmstat.c 关本地中断调用 __dec_zone_page_state //vmstat.c migrate_page_move_mapping //migrate.c 传参:(oldzone->zone_pgdat, NR_FILE_PAGES) __dec_zone_state //vmstat.h atomic_long_dec(&vm_zone_stat[item]) refresh_cpu_vm_stats(do_pagesets) //vmstat.c cpu_vm_stats_fold(cpu) //vmstat.c fold_diff(int *zone_diff, int *node_diff) //vmstat.c atomic_long_add(zone_diff[i], &vm_zone_stat[i]); zone_pcp_reset(zone) //page_alloc.c drain_zonestat(struct zone *zone, struct per_cpu_pageset *pset) //vmstat.c atomic_long_add(v, &vm_zone_stat[i]);
1.1. NR_FREE_PAGES 统计
set_migratetype_isolate //page_isolation.c 传参:(zone, -nr_pages, mt) 将isolate的page移除 unset_migratetype_isolate //page_isolation.c 传参: (zone, nr_pages, migratetype) 将unisolate的page加上 set_page_guard //page_alloc.c 将用于guard的page从统计中移除 clear_page_guard //page_alloc.c 将从guard取消的page加入统计中 free_pcppages_bulk //page_alloc.c free_one_page //page_alloc.c __free_one_page //page_alloc.c 将free的page加入到统计中 __isolate_free_page //page_alloc.c 将isolate的page从统计中移除 get_page_from_freelist //page_alloc.c rmqueue //page_alloc.c 将从buddy中分配走的page从统计中移除 __mod_zone_freepage_state //vmstat.h 传参: (zone, NR_FREE_PAGES, nr_pages) rmqueue_bulk //page_alloc.c 传参: (zone, NR_FREE_PAGES, -(i << order)) __mod_zone_page_state //vmstat.c zone_page_state_add //vmstat.h //可能不是这里 atomic_long_add(x, &vm_zone_stat[item]);
vm_zone_stat[NR_FREE_PAGES] 应该表示伙伴系统中空闲页面的数量。
cat /proc/meminfo 中的"MemFree" 字段显示的就是 vm_zone_stat[NR_FREE_PAGES]。cat /proc/vmstat 的 "nr_free_pages" 字段显示的也是它.
标签:传参,alloc,zone,含义,35,vmstat,内存,NR,page From: https://www.cnblogs.com/hellokitty2/p/18415605