[转]Virtio balloon
http://rwmj.wordpress.com/2010/07/17/virtio-balloon/
After someone asked me a question about “balloons” (in the virtualization sense) today, I noticed that there is not very much documentation around. This post explains what the KVM virtio_balloon driver is all about.
First of all, what is a balloon driver if you’ve never even heard of the concept? It’s a way to give or take RAM from a guest. (In theory at least), if your guest needs more RAM, you can use the balloon driver to give it more RAM. Or if the host needs to take RAM away from guests, it can do so. All of this is donewithout needing to pause or reboot the guest.
You might think that this would work as a RAM “hot add” feature, rather like hot adding disks to a guest. Although RAM hot add would (IMHO) be much better, currently this is not how ballooning works.
What we have is a kernel driver inside the guest called virtio_balloon. This driver acts like a kind of weird process, either expanding its own memory usage or shrinking down to nearly nothing, as in the diagrams below:


When the balloon driver expands, normal applications running in the guest suddenly have a lot less memory and the guest does the usual things it does when there’s not much memory, including swapping stuff out and starting up the OOM killer. (The balloon itself is non-swappable and un-killable in case you were wondering).
So what’s the point of a kernel driver which wastes memory? There are two points: Firstly, the driver communicates with the host (over the virtio channel), and the host gives it instructions (“expand to this size”, “shrink down now”). The guest cooperates, but doesn’t directly control the balloon.
Secondly, memory pages in the balloon are unmapped from the guest and handed back to the host, so the host can hand them out to other guests. It’s like the guest’s memory has a chunk missing from it:

Libvirt has two settings you can control called currentMemory and maxMemory (“memory” in the libvirt XML):

maxMemory (or just <memory>) is the memory allocated at boot time to a guest. KVM and Xen guests currently cannot exceed this. currentMemory controls what memory you’re requesting to give to the guest’s applications. The balloon fills the rest of the memory and gives it back to the host for the host to use elsewhere.
You can adjust this manually for your guests, either by editing the XML, or by using the virsh setmem command.
[转]Virtio balloon的更多相关文章
- 【制作镜像Win*】系统配置
向livibirt.xml插入Line 6-13所示代码,即加入两个virtio-serial设备: <!--vnc方式登录,端口号自动分配,自动加1,可以通过virsh vncdisplay来 ...
- KVM虚拟化技术
KVM虚拟化技术 Qemu-kvm kvm virt-manager VNC Qemu-kvm创建和管理虚拟机 一.KVM简介 KVM(名称来自英语:Kernel-basedVirtual Machi ...
- 别以为真懂Openstack: 虚拟机创建的50个步骤和100个知识点(4)
六.Libvirt 对于Libvirt,在启动虚拟机之前,首先需要define虚拟机,是一个XML格式的文件 列出所有的Instance # virsh list Id Name ...
- lab-kvm
3)qemu帮助信息 qemu-kvm -h [root@Centos72 libvirt]#qemu-kvm -h QEMU emulator version (qemu-kvm--.el7_5.) ...
- centos6.7环境之kvm虚拟化quem工具配置及使用详解
环境准备 需要勾选CPU的虚拟化支持,支持cpu虚拟化的CPU列表: intel支持虚拟化技术CPU列表: Intel 6 Cores / 12 Threads CPU Number: Code Na ...
- KVM的qemu-kvm使用
KVM: kvm,x86支持硬件辅助虚拟化技术(hvm) grep -E "(vmx|svm)" /proc/cpuinfo [root@dmsag ~]# ll /dev/kvm ...
- Linux内核配置选项
http://blog.csdn.net/wdsfup/article/details/52302142 http://www.manew.com/blog-166674-12962.html Gen ...
- Libvirt中windows虚拟机的动态内存管理
非常短的前提 Libvirt支持对虚拟机进行内存动态扩展,可是windows虚拟机首先须要安装virtio-win驱动. KVM提供的virtio-win驱动下载地址: http://www.linu ...
- KVM在线扩展虚拟机内存
环境介绍 在KVM下有一台虚拟机内存不够需要扩展内存.宿主机地址是192.168.1.28.我需要扩展的虚拟机是centos1708vm03. 1.登陆上宿主机查看虚拟机配置 virsh dumpxm ...
随机推荐
- 通信导论-IP数据网络基础(4)
IP地址的编址方法--IP地址+掩码地址=网络地址 分类的IP地址 每一类地址都由两个固定长度的字段组成,其中一个字段是网络号 net-id,标志主机或路由器所连接到的网络,另一个字段则是主机号 ho ...
- Python学习笔记5程序的控制结构
1.分支结构 (1)单分支结构 (2)二分支结构 (3)多分支结构 条件判断 (4)程序的异常处理 2.实例:身体质量指数BMI 思路一(国内,稍作修改就是国际): 思路二: height,weigh ...
- 【算法】BM算法
目录 BM算法 一. 字符串比较的分析 二.BM算法的思想 三.算法实现 BM算法 @ 一. 字符串比较的分析 如果要判定长度为\(n\)两个字符串相等,比较中要进行\(n\)比较,但是如果要判定两个 ...
- synchronized 同步函数的竞争关系验证
synchronized是Java中的关键字,是一种同步锁.它修饰的对象有以下几种: 1. 修饰一个代码块,被修饰的代码块称为同步语句块,其作用的范围是大括号{}括起来的代码,作用的对象是调用这个代码 ...
- 部署harbor仓库相关问题总结
切换到harbor目录docker-compose down 停止所有服务 docker-compose up -d 启动所用服务 卸载:停止服务后 使用:docker rmi --force $(d ...
- Quartz.Net进阶之六:详述 JobStores
一.介绍 今天开始学习 JobStore,别的先不说,也不用翻译软件来翻译,直接从字面意思看来理解一下.我第一眼的感觉就是 job 是任务的意思,Store 是商店的意思,连起来就是可以存储 Job ...
- 关于webservlet 请求异步处理,链接未关闭出现的bug
webservlet +redis 的消息发布订阅 ,挺好的 当请求到来,向redis server申请一个频道 ,然后等着另一端架设是B 处理完毕获得到处理信息调用redis ,使用redis 往 ...
- filter 全局和局部过滤器
1,局部过滤器 2,全局过滤器 使用方法相同,在花括号中使用过滤器名或者v-bind中使用
- 生信分析常用脚本(二)--SOAPdenovo
1.SOAPDenovo配置文件示例 软件下载安装和使用:http://soap.genomics.org.cn/soapdenovo.html asm.cfg #maximal read lengt ...
- 201621123002《java程序设计》第九周学习总结
1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结集合与泛型相关内容. 1.2 选做:收集你认为有用的代码片段 //功能需求:将所有大于5的生成一个新的List对象 List lis ...