当前位置: 首页 > news >正文

Memblock-2

memblock是内核的第一个内存分配器,其主要应用在boot阶段。但是当memory hotplug功能启动时,其也可以运行在runtime阶段。memblock在linux v2.6.35 in 2010 引入内核,后逐步取代了bootmem分配器,成为了内核启动早期唯一的内存分配器。

It is also used to support hotplug memory and to switch to the buddy allocator after adding memory added at runtime using memblock.

Structure of Memblock

Memblock is managed by dividing it into two types as follows:

  • memory type
    •  The memory type is used by registering the physical memory area to be used. It can be registered by limiting the use of only a part of the actual physical memory by kernel parameters. Initially, up to 128 areas can be used in the regions[ ] array, and it can be continuously expanded in units of 2 in the future.
  • reserved type
    • The reserved type is used by registering a physical memory area that is in use or will be used. Initially, up to 128 areas can be used in the regions[ ] array, and it can be continuously expanded in units of 2 in the future.

The following figure shows the relationship between the memblock, memblock_type, and memblock_regions structures.

API

memblock_add()

memblock_reserve()

memblock_add_range()

The figure below shows the six existing regions registered in gray, and the six cases in which a new memblock is added in sky blue, compared from region[0] in the direction of the arrow.

  • If the area to be added overlaps with the existing memblock area, it is first split into non-overlapping areas and added, and then the adjacent blocks are finally merged.
  • insertion number
    • The number of actual insertions that occur when a memblock is added.
  • Number of cnts after merge
    • The number of memblocks that will ultimately remain after merging

memblock array expansion

memblock_double_array()

memblock merge

memblock_merge_regions()

Delete memblock

The following figure shows the memblock areas that change when the yellow remove range is deleted among the four memblock areas.

memblock separation

The following figure shows how the memblock_ioslate_range() function is processed.

The following figure shows the comparison from region[0] in the direction of the arrow when each of the six memblock regions, marked in gray, is given a sky-blue isolation region.

  • If the area to be separated overlaps with an existing memblock area, the overlapping part divides the memblock. And the part without a memblock is added.
  • insertion
    • The number of actual insertions that occur when a memblock is added is displayed.
  • start_rgn
    • Index number of an existing memblock area that overlaps the start of the isolation range
  • end_rgn
    • Index number of the existing memblock area that overlaps the end of the isolation range + 1

The following figure illustrates the first part of the six examples above in a little more detail.

  • In the case of (C) and (D), when inserting, the idx area being processed is pushed up and added.
  • (D) When proceeding with case, be careful to proceed with the area corresponding to idx once again.

 

The following figure illustrates the third part of the six examples above in a bit more detail.

http://www.dtcms.com/a/418989.html

相关文章:

  • 从芯片发布看未来AI发展趋势与前景
  • 【案例教程】生态碳汇涡度通量数据质量控制、缺失插补、可视化分析、光敏感性分析、温度敏感性分析、数据风浪区分析
  • 牛商网 做的p2p网站公司名称变更通知函
  • 音视频学习(六十七):音视频像素格式
  • XCSSET新变种:专攻苹果macOS用户,实现窃密+勒索
  • 在线教育网站有什么程序做wordpress加标题
  • LeetCode-Hot100 最小栈实现
  • flutter 详细解读
  • 开县做网站汉中网络推广
  • C# TCP - 串口转发
  • 广州 济南网站建设公司 网络服务江苏网站备案流程图
  • Ceph 分布式存储学习笔记(一):介绍、部署与集群配置(上)
  • 先做他个天猫网站产品外观设计图片
  • Accelerate 与 torchrun 分布式训练LLM对比
  • 建设部网站哪里可以报名考监理员优化优化
  • 农家乐怎么做网站上海app开发网站建设
  • 海口建站价格网站建设的物流
  • Leetcode 26. 删除有序数组中的重复项
  • Linux 的文本编辑器vim食用指南
  • 开发实战:从0到1实现Chrome元素截图插件的完整过程
  • ue编辑器视口鼠标消失的问题
  • 【数据结构】多项式的基本运算
  • 在ubuntu下载企业微信
  • 基于Chrome140的FB账号自动化——需求分析环境搭建(一)
  • MCP:cursor、claude code接入chrome-devtools-mcp。
  • 台风“桦加沙”袭击大,盈电智控物联网漏水检测系统为关键场所筑牢“隐形堤坝”!
  • 北京比较好的互联网公司晋中seo排名
  • 高通平台WiFi学习---深入了解 WLAN host crash调试
  • 在 Ubuntu 上可以用几个常用命令查看系统运行情况(内存、CPU、硬盘占用等
  • 子路由器如何设置 路由器LAN-WAN级联的设置方法