vmalloc_init
/* linux/mm/vmalloc.c*/
struct vmap_area {
unsigned long va_start;
unsigned long va_end;
unsigned long flags;
struct rb_node rb_node; /* address sorted rbtree */
struct list_head list; /* address sorted list */
struct list_head purge_list; /* "lazy purge" list */
void *private;
struct rcu_head rcu_head;
}; /*
* 显示通过vmalloc分配的内存区域,个vm_struct通过红黑树管理,
* 红黑树的各节点显示为vmap_area结构体
*/
struct vm_struct {
struct vm_struct *next;
void *addr;
unsigned long size;
unsigned long flags;
struct page **pages;
unsigned int nr_pages;
unsigned long phys_addr;
void *caller;
}; struct vmap_block_queue {
spinlock_t lock;
struct list_head free;
struct list_head dirty;
unsigned int nr_dirty;
};
struct vmap_block {
spinlock_t lock;
struct vmap_area *va;
struct vmap_block_queue *vbq;
unsigned long free, dirty;
DECLARE_BITMAP(alloc_map, VMAP_BBMAP_BITS);
DECLARE_BITMAP(dirty_map, VMAP_BBMAP_BITS);
union {
struct list_head free_list;
struct rcu_head rcu_head;
};
};
/* Queue of free and dirty vmap blocks, for allocation and flushing purposes */
static DEFINE_PER_CPU(struct vmap_block_queue, vmap_block_queue); void __init vmalloc_init(void) /*以下代码应该在 中执行*/
int rc;
rc = pcpu_embed_first_chunk(PERCPU_MODULE_RESERVE,PERCPU_DYNAMIC_RESERVE,
PAGE_SIZE,NULL,pcpu_dfl_fc_alloc,pcpu_dfl_fc_free);
if (rc<)
panic("Failed to initialize percpu areas."); /*
* linux/mm/vmalloc.c
* 全局变量vmlist的初始化流程
*/
struct vm_struct *vmlist;
asmlinkage void __init start_kernel(void)
-->setup_per_cpu_areas();
-->ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size,
ssize_t dyn_size, ssize_t unit_size)
-->size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
size_t static_size, size_t reserved_size,
ssize_t dyn_size, ssize_t unit_size,
void *base_addr,
pcpu_populate_pte_fn_t populate_pte_fn)
-->void __init vm_area_register_early(struct vm_struct *vm, size_t align)
-->vmlist = vm; /*建立vm_struct与vmap_area的关联*/
#define RB_ROOT (struct rb_root) { NULL, }
static struct rb_root vmap_area_root = RB_ROOT;
static LIST_HEAD(vmap_area_list); static void __insert_vmap_area(struct vmap_area *va)
vmalloc_init的更多相关文章
- 内存管理 初始化(六)vmalloc_init 及 ioremap
是不是我错了,本想这个函数会如网上所说将进行非连续内存管理的初始化,但是对于2.6.34的ARM架构而言,该函数实际完成的业务非常少. 内存管理的初始化读到此处,我感觉原有的认识存在很大缺陷: (1) ...
- Linux---从start_kernel到init进程启动
“平安的祝福 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 ” ini ...
- Linux内核启动分析
张超<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 我的代码可见https://www.shiyanlo ...
- Linux内核源码分析--内核启动之(3)Image内核启动(C语言部分)(Linux-3.0 ARMv7)
http://blog.chinaunix.net/uid-20543672-id-3157283.html Linux内核源码分析--内核启动之(3)Image内核启动(C语言部分)(Linux-3 ...
- 基于TQ2440和Qemu的GDB+串口调试(1)
作者 彭东林 pengdonglin137@163.com 平台 TQ2440 + Linux-4.10.17 Qemu(vexpress-ca9) + Linux-4.10.17 概述 下面 ...
- ARM Linux内核源码剖析索引
start_kernel -->asm-offset.h 生成 -->proc_info_list -->machine_desc -->__vet_atags --> ...
- Linux-3.14.12内存管理笔记【伙伴管理算法(2)】
前面已经分析了linux内存管理算法(伙伴管理算法)的准备工作. 具体的算法初始化则回到start_kernel()函数接着往下走,下一个函数是mm_init(): [file:/init/main. ...
- 2019-2020-1 20199312《Linux内核原理与分析》第四周作业
计算机和操作系统的法宝 计算机三个法宝 存储程序计算机.函数调用堆栈机制.中断 操作系统:中断中断上下文的切换--保护和恢复现场 进程上下文的切换. Linux源代码目录分析 arch目录:代码量庞大 ...
- 谈谈Linux系统启动流程
@ 目录 大体流程分析 一.BIOS 1.1 BIOS简介 1.2 POST 二.BootLoader (GRUB) 2.1 What's MBR? 2.2 What's GRUB? 2.3 boot ...
随机推荐
- python 基础(十) 面向对象
面向对象 一.概念 类(class): 用来描述具有相同属性和方法的对象的集合 对象是类的实例化 类变量:类变量在整个实例化的对象中是共用的.定义在类中 并且是函数体外的 实例变量:只能作用于 当前类 ...
- 洛谷P3177||bzoj4033 [HAOI2015]树上染色
洛谷P3177 bzoj4033 根本不会做... 上网查了题解,发现只要在状态定义的时候就考虑每一条边全局的贡献就好了? 考虑边的贡献和修改状态定义我都想到了,然而并不能想到要结合起来 ans[i] ...
- 栈 && 教授的测试
卡特兰数:https://blog.csdn.net/wu_tongtong/article/details/78161211 https://www.luogu.org/problemnew/sho ...
- Crusher Django 学习笔记2 基本url配置
http://crusher-milling.blogspot.com/2013/09/crusher-django-tutorial2-conf-basic-url.html 顺便学习一下FQ Cr ...
- Windows忘记mysql的密码
1.查看mysql的安装路径 show variables like "%char%"; 路径:C:\Program Files\MySQL\MySQL Server 5.7\ 2 ...
- css3のtext-shadow
text-shadow,让我们大家一起来学习一下吧. 语法: text-shadow:none | <shadow> [ , <shadow> ]* <shadow> ...
- 后端 node 项目工具集
后端 node 项目工具集 editor vs code webstorm 质量检查 eslint prettier 命令行相关 better-run-npm npm-run-all nodemon ...
- SourceGrid之Grid绑定数据
private void BindData() { //为绑定的按钮选线增加单击事件 SourceGrid.Cells.Controllers.CustomEvents clickEvent = ne ...
- C#实现MD5WITHRSA签名
这是很久以前的写的一篇博客了,今天把他重新找出来整理一下发布到博客园 当时对接银联的时候搞了很久都没搞出来,后来一个偶然的机会发现类似的一个代码参考了一下终于弄好了 这段代码主要是实现了C#服务端对接 ...
- 分享一个WebGL开发的网站-用JavaScript + WebGL开发3D模型
这张图每位程序员应该都深有感触. 人民心目中的程序员是这样的:坐在电脑面前噼里啪啦敲着键盘,运键如飞. 现实中程序员是这样的:编码5分钟,调试两小时. 今天我要给大家分享一个用WebGL开发的网站,感 ...