CpuMemSets在Linux操作系统中的实现
http://tech.ddvip.com 2007年03月11日 社区交流
本文详细介绍CpuMemSets在Linux操作系统中的实现
每个虚拟存储区都拥有各自的vm_mems_allowed位向量。新建虚拟存储区的vm_mems_ allowed通过cms_current_mems_allowed()继承自创建者任务current_cms的mems_allowed。对于被挂接的已存在的虚拟存储区,如mmap的内存对象和共享内存区,则继承自挂接进程current_cms的mems_allowed。cms的mems_allowed位向量由mems_allowed_build(cms)根据cms中的所有内存块列表来构造。
【include/linux/mm.h】
45 struct vm_area_struct {
:
77 unsigned long vm_mems_allowed; /* cpumemset managed memory placement */
:
81 };
【kernel/cpumemset.c】
1538 static unsigned long
1539 mems_allowed_build(cpumemset_t *cms)
1540 {
1541 int i;
1542 unsigned long mems_allowed = 0;
1543
1544 for (i = 0; i < cms->nr_mems; i++)
1545 mems_allowed |= mems_allowed_value(cms, cms->mems + i);
1546 return mems_allowed;
1547 }3.2 进程调度及内存分配
内核调用update_cpus_allowed(struct task_struct *p)根据任务的current_cms的处理器列表更改它的cpus_allowed位向量,从而影响该任务的处理器调度。
【kernel/cpumemset.c】
585 void
586 update_cpus_allowed(struct task_struct *p)
587 {
588 #ifdef CONFIG_SMP
589 int i;
590 cpumemset_t *cms = p->current_cms;
591 cpumask_t cpus_allowed = CPU_MASK_NONE;
592
593 for (i = 0; i < cms->nr_cpus; i++)
594 __set_bit(cms->cmm->cpus[cms->cpus[i]], &cpus_allowed);
595 if (any_online_cpu((cpumask_t*)&cpu_online_map) < NR_CPUS) {
:
609 set_cpus_allowed(p, &cpus_allowed);
610 }
611 #endif
612 }
作者:Maker 责编:豆豆技术应用
正在加载评论...
- Linux/Unix 新闻
- Linux/Unix 入门
- Linux/Unix 命令
- Linux/Unix 安装
- Linux 嵌入式系统
- Linux/Unix 编程
- Linux/Unix 管理
- Linux/Unix 桌面
- Linux/Unix 内核
- Linux/Unix 软件
- SCO Unix
- NetBSD
- OpenBSD
- Redhat/Fedora Linux
- 手机
- Linux/Unix find 搜索命令
- Linux/Unix vi 命令
- Linux/Unix kde 桌面环境
- Linux/Unix GNOME 桌面环境
- Linux/Unix Make 命令
- Linux/Unix crontab 命令
- Linux/Unix ext3 文件系统
- Linux/Unix 文件系统详解
- Linux/Unix ADSL 拨号设置
- Linux/Unix GRUB 配置及应用
- Linux/Unix nfs配置
- Linux/Unix 硬件信息查看及管理
- Linux/Unix 优化
- Linux/Unix 交换分区Swap管理及应用
- Linux/Unix 用户管理
- Linux/Unix Ramdisk
- Linux/Unix 密码恢复管理
- Linux/Unix 文件删除恢复
- Linux/Unix fdisk分区
- Linux/Unix lvs负载均衡管理
- Linux/Unix root用户
- Linux/Unix 集群
- Linux/Unix 日志
- 更多Linux/Unix专题……