• 欢迎访问速搜资源吧,如果在网站上找不到你需要的资源,可以在留言板上留言,管理员会尽量满足你!

【速搜问答】zswap是什么

问答 admin 3周前 (04-11) 29次浏览 已收录 0个评论

汉英对照:
Chinese-English Translation:

zswap是一项Linux内核的虚拟内存压缩功能,可为将要交换的页面提供压缩回写缓存。

Zswap is a virtual memory compression function of Linux kernel, which can provide compressed write back cache for pages to be exchanged.

zswap 是一项 Linux 内核的虚拟内存压缩功能,可为将要交换的页面提供压缩回写缓存。

Zswap is a virtual memory compression function of Linux kernel, which can provide compressed write back cache for pages to be exchanged.

简介

brief introduction

当内存页将要交换出去时,zswap 不将其移动到交换设备,而是对其执行压缩,然后存储到系统 RAM 内动态分配的内存池中。回写到实际交换设备的动作则会延迟,甚至能完全避免,从而显著减少 Linux 系统用于交换的 I/O;副作用则是压缩所需的额外 CPU 周期。zSWAP 并不虚拟一个块设备,而是 hook 到普通的 swap 代码里,在实际发生写入到磁盘/从磁盘读取的操作前,先利用自己管理的内存进行数据的换出/换入,内存不够用以后再使用传统的 swap 分区。所以 zSWAP 适用于本身已经有交换分区的系统,而 zRAM 更适合 Android 这样本身不配置交换分区的嵌入式系统。

When a memory page is about to be swapped out, zswap does not move it to the swapping device, but compresses it, and then stores it in the memory pool dynamically allocated in the system RAM. The action of writing back to the actual switching device will be delayed, or even completely avoided, thus significantly reducing the I / O of Linux system for switching; the side effect is the additional CPU cycles required for compression. Zswap is not a virtual block device. Instead, it hooks into the common swap code. Before the actual write to disk / read from disk operation, it uses its own memory to swap out / in the data. When the memory is not enough, it uses the traditional swap partition. Therefore, zswap is suitable for systems with swap partition, while zram is more suitable for Android embedded systems without swap partition.

发展背景

Development background

3.11 版 Linux 内核丰要实现了以下新功能:加入了用于创建安全临时文件的标识位 OTMPFILE;实验性的 Radeon 显卞动态电源管理支持,需要传递 radeon.dpm=1 参数启用;针对并行分布式文件系统 Lustre 的客户端支持;初步支持 NFS42 和具备 SELinmx 标签的 NFS 分区;详细的页面写入历史追踪等。此外还改善了 SYSVIPc 消息队列扩展性,允许应用程序请求低延迟网络 Polling,并增加可压缩交换分区缓存 Zswap。

The Linux kernel version 3.11 has the following new functions: the identification bit otmpfile used to create secure temporary files has been added; the experimental dynamic power management support of radon has to be transferred radeon.dpm=1 Parameter enabled; client support for parallel distributed file system lustre; initial support for nfs42 and NFS with selinmx tag Partition; detailed page writing history tracking, etc. In addition, it improves the scalability of sysvipc message queue, allows applications to request low latency network polling, and increases the compression switch partition cache zswap.

zswap 与 zRam

Zswap and zram

zRam 其实有两个很大的问题,就是当内存快填满的时候,zRam 本身会试图向内存返回数据,而系统会试图向 zRam 中填充数据。

In fact, zram has two big problems, that is, when the memory is almost full, zram itself will try to return data to the memory, and the system will try to fill data into zram.

zRam 的实现是把自己虚拟成一个 swap 分区。而 zSwap 则是介入了内核的 swap 过程,将所有被系统 swap 出来的数据全部截留,存入自己的存储器中。这种实现方式有个好处,就是能和真正存在于硬盘上的 swap 分区联合使用。也避免了 zRam 的两大问题。  因为 zSwap 在面临内存不足时可以向 swap 分区写入数据,而不会试图向内存中返回数据。另一方面,如果有大段内存被空闲程序占据,zSwap 可以把这些数据填入硬盘中。由于这些内存极少被使用,所以存入较慢的硬盘也不会影响运行速度。

The implementation of zram is to virtualize itself into a swap partition. Zswap is involved in the swap process of the kernel, which intercepts all the data from the system swap and stores them in its own memory. One advantage of this implementation is that it can be used in combination with the swap partition that really exists on the hard disk. It also avoids the two problems of zram. This is because zswap can write data to swap partition when it is faced with insufficient memory, without trying to return data to memory. On the other hand, if a large amount of memory is occupied by idle programs, zswap can fill the data into the hard disk. Since this memory is rarely used, storing it in a slower hard disk will not affect the running speed.

zSwap 其实可以工作在和 zRam 一样的模式下,只要不要设置 swap 分区即可。

In fact, zswap can work in the same mode as zram, just set the swap partition.


速搜资源网 , 版权所有丨如未注明 , 均为原创丨转载请注明原文链接:【速搜问答】zswap是什么
喜欢 (0)
[361009623@qq.com]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址