static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, struct page **pagep, enum sgp_type sgp, gfp_t gfp, int *fault_type) { ... if (sbinfo->max_blocks) { ///dev/shm会有该值 if (percpu_counter_compare(&sbinfo->used_blocks,sbinfo->max_blocks) >= 0) { error = -ENOSPC; goto unacct; } percpu_counter_inc(&sbinfo->used_blocks); } //分派一个物理PAGE page = shmem_alloc_page(gfp, info, index); if (!page) { error = -ENOMEM; goto decused; } SetPageSwapBacked(page); __set_page_locked(page); error = mem_cgroup_cache_charge(page, current->mm,gfp & GFP_RECLAIM_MASK); ///mem_cgroup检查 if (!error) error = shmem_add_to_page_cache(page, mapping, index, gfp, NULL); 总结
(2)经由过程/proc/sys/kernel/shmmax可以限制SYS V共享内存(单个)的最大年夜值,经由过程/dev/shm可以限制POSIX共享内存的最大年夜值(所有之和)。
【编辑推荐】
- 17个案例带你3分钟搞定Linux正则表达式
- CoreOS,一款Linux容器发行版
- 编写Linux Shell脚本的最佳实践
- Linux自带i2c对象应用
- 应用Nmon监控Linux的体系机能
【义务编辑:枯木 TEL:(010)68476606】
点击(此处)折叠或打开
推荐阅读
Windows 7系统U盘插入后假死怎么处理?
Win7体系U盘插入后假逝世怎么处理?有效户表示,在Win7体系下,U盘插入后体系会出现假逝世的问题,一般十几秒钟就恢复正常了,固然对操作体系毫无影响,我们却不想存在任何假设的病毒存在,>>>详细阅读
本文标题:浅析Linux的共享内存与tmpfs文件系统
地址:http://www.17bianji.com/lsqh/36688.html
1/2 1