SIGBUS
当应用拜访共享内存对应的地址空间,如不雅对应的物理PAGE还没有分派,就会调用fault办法,分派掉败,就会返回OOM或者BIGBUS缺点:
点击(此处)折叠或打开
共享内存与CGROUP
今朝,共享内存的空间计算在第一个拜访共享内存的group,参考:
l http://lwn.net/Articles/516541/
(1)POSIX共享内存与SYS V共享内存在内核都是经由过程tmpfs实现,但对应两个不合的tmpfs实例,互相自力。
l https://www.kernel.org/doc/Documentation/cgroups/memory.txt
POSIX共享内存与Docker
今朝Docker将/dev/shm限制为64M,却没有供给参数,这种做法比较糟糕。如不雅应用应用大年夜内存的POSIX共享内存,必定会导致问题。 参考:
l https://github.com/docker/docker/issues/2606
l https://github.com/docker/docker/pull/4981
- static const struct vm_operations_struct shmem_vm_ops = {
- .fault = shmem_fault,
- #ifdef CONFIG_NUMA
- .set_policy = shmem_set_policy,
- .get_policy = shmem_get_policy,
- #endif
- };
- static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
- {
- struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
- int error;
- int ret = VM_FAULT_LOCKED;
- error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret);
- if (error)
- return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS);
- return ret;
- }
- shmem_getpage –> shmem_getpage_gfp:
- /*
- * shmem_getpage_gfp - find page in cache, or get from swap, or allocate
- *
- * If we allocate a new one we do not mark it dirty. That's up to the
- * vm. If we swap it in we mark it dirty since we also free the swap
- * entry since a page cannot live in both the swap and page cache
- */
推荐阅读
Win7体系U盘插入后假逝世怎么处理?有效户表示,在Win7体系下,U盘插入后体系会出现假逝世的问题,一般十几秒钟就恢复正常了,固然对操作体系毫无影响,我们却不想存在任何假设的病毒存在,>>>详细阅读
地址:http://www.17bianji.com/lsqh/36688.html
1/2 1