/* 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的更多相关文章

  1. 内存管理 初始化(六)vmalloc_init 及 ioremap

    是不是我错了,本想这个函数会如网上所说将进行非连续内存管理的初始化,但是对于2.6.34的ARM架构而言,该函数实际完成的业务非常少. 内存管理的初始化读到此处,我感觉原有的认识存在很大缺陷: (1) ...

  2. Linux---从start_kernel到init进程启动

    “平安的祝福 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 ” ini ...

  3. Linux内核启动分析

    张超<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 我的代码可见https://www.shiyanlo ...

  4. Linux内核源码分析--内核启动之(3)Image内核启动(C语言部分)(Linux-3.0 ARMv7)

    http://blog.chinaunix.net/uid-20543672-id-3157283.html Linux内核源码分析--内核启动之(3)Image内核启动(C语言部分)(Linux-3 ...

  5. 基于TQ2440和Qemu的GDB+串口调试(1)

    作者 彭东林 pengdonglin137@163.com   平台 TQ2440 + Linux-4.10.17 Qemu(vexpress-ca9) + Linux-4.10.17   概述 下面 ...

  6. ARM Linux内核源码剖析索引

    start_kernel -->asm-offset.h 生成 -->proc_info_list   -->machine_desc -->__vet_atags --> ...

  7. Linux-3.14.12内存管理笔记【伙伴管理算法(2)】

    前面已经分析了linux内存管理算法(伙伴管理算法)的准备工作. 具体的算法初始化则回到start_kernel()函数接着往下走,下一个函数是mm_init(): [file:/init/main. ...

  8. 2019-2020-1 20199312《Linux内核原理与分析》第四周作业

    计算机和操作系统的法宝 计算机三个法宝 存储程序计算机.函数调用堆栈机制.中断 操作系统:中断中断上下文的切换--保护和恢复现场 进程上下文的切换. Linux源代码目录分析 arch目录:代码量庞大 ...

  9. 谈谈Linux系统启动流程

    @ 目录 大体流程分析 一.BIOS 1.1 BIOS简介 1.2 POST 二.BootLoader (GRUB) 2.1 What's MBR? 2.2 What's GRUB? 2.3 boot ...

随机推荐

  1. 8. 字符串转换整数 (atoi)

    8. 字符串转换整数 (atoi) 方法一 import re import math class Solution(object): def myAtoi(self, str): "&qu ...

  2. python 基础(十三) time模块

    日期和时间 一.time模块 import time 时间戳: 时间戳是指格林威治时间1970年1月1日0时0分0秒至现在的秒数   s(秒).ms(毫秒).μs(微秒).ns(纳秒), ​ 其中:1 ...

  3. Springboot日志配置探索(主要看logback)(二)

    这篇博客主要是讲在Springboot中扩展的日志框架的配置,也是主要讲logback 8 继续看文档,这里讲到: springboot里面还有几个日志系统框架可以选择使用,你可以通过在classpa ...

  4. shell脚本实现自动化备份

    1.备份规则: 在生产环境中有若干服务器需要定时将服务器中应用程序,以及数据库等进行备份.要求在本地服务器中保存近一周的备份,备份服务器中保存最近一月的备份文件.                    ...

  5. IIS+PHP访问量大时内存爆满等性能问题解决方案

    如今还是有许多人在用老掉牙的 IIS6 + PHP.本文解决方法适用于使用 FastCGI 运行 PHP 的用户. 问题原因: 你可以试一试,你在 VPS 上用 IIS6 安装 FastCGI 跑 P ...

  6. laravel 5.5 oauth2.0 跨域问题解决方案

    一.laravel-Cors 安装 在终端执行安装命令如下: composer require barryvdh/laravel-cors 添加服务提供商 在Laravel配置文件app.php的pr ...

  7. 【持续更新】CSS居中

    水平垂直居中 知道自身的宽度.高度 <div class="test"></div> <style> .test { position: abs ...

  8. CSS子元素设置margin-top作用于父容器?

    CSS子元素设置margin-top作用于父容器? 原因: In this specification, the expression collapsing margins means that ad ...

  9. poj 2406 Power Strings 周期问题

    Power Strings Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 48139   Accepted: 20040 D ...

  10. ubuntu中使用eclipse开发android,logcat显示问题

    〜/工作区/ .metadata / .plugins / org.eclipse.core.runtime / .settings / com.android.ide.eclipse.ddms.pr ...