有人知道linux内核中的ZRAM和ZSWAP有什么区别吗?它们看起来非常相似--在ram中存储压缩的页面。
发布于 2013-08-26 13:41:44
Linux ZRAM是内核的一个模块,以前称为“compcache.”。ZRAM通过避免磁盘上的分页来提高性能,而是使用RAM中的压缩块设备,在该设备中进行分页,直到需要使用硬盘驱动器上的交换空间为止。由于使用RAM比使用磁盘更快,因此zram允许Linux在需要交换/分页时更多地使用RAM,特别是在安装了较少RAM的旧计算机上。
ZSWAP是一个用于交换页面的轻量级压缩缓存。它接收正在被换出的页面,并尝试将它们压缩到动态分配的基于RAM的内存池中。zswap基本上是用CPU周期来换取可能减少的交换I/O。如果从压缩缓存读取的速度比从交换设备读取的速度快,这种权衡也可以显著提高性能。
发布于 2013-09-04 02:04:25
zram
主线内核中提供
的需求
1. Eliminates need for physical swap device. This beame popular when netbooks first showed up. Zram (then compcache) allowed users to avoid swap shortening the lifespan of SSDs in these memory constrained systems.
2. A zram block device can be used for other applications other than swap, anything you might use a block device for conceivably.
1. Once a page is stored in zram it will remain there until paged in or invalidated. The first pages to be paged out will be the oldest pages (LRU list), these are 'cold' pages that are infrequently access. As the system continues to swap it will move on to pages that are warmer (more frequently accessed), these may not be able to be stored because of the swap slots consumed by the cold pages. What zram can not do (compcache had the option to configure a block backing device) is to evict pages out to physical disk. Ideally you want to age data out of the in-kernel compressed swap space out to disk so that you can use kernel memory for caching warm swap pages or free it for more productive use.
zswap
从3.11版本开始,主线内核中提供了
)的写后cache.
1. Integration with swap code (using Frontswap API) allows zswap to choose to store only pages that compress well and handle memory allocation failures, in those cases pages are sent to the backing swap device.
2. Oldest pages in the cache are pushed out to backing swap device to make room for newer pages, this solves the LRU inversion problem that a lack of page eviction would present.
1. Needs a physical swap device (or swapfile).
https://stackoverflow.com/questions/18437205
复制相似问题