发布于 2016-10-12 12:18:31
对于2.,zswap似乎确实可以解压回传中的页面,从而确认@Cbhihe的评论。
mm/zswap.c,第828行:
/*
* Attempts to free an entry by adding a page to the swap cache,
* decompressing the entry data into the page, and issuing a
* bio write to write the page back to the swap device.
* ...
*/
static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
{
...
case ZSWAP_SWAPCACHE_NEW: /* page is locked */
/* decompress */
...
ret = crypto_comp_decompress(tfm, src, entry->length,
dst, &dlen);
...
kunmap_atomic(dst);
$ git show
commit 1573d2caf713874cfe0d1336c823d0fb548d8bed
Merge: 4cdf8db 0a86248
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Tue Oct 11 23:59:07 2016 -0700因此,在将压缩后的内存缓存写回磁盘之前很可能会忘记的情况下,zswap是有用的。它并不适用于大的、长寿命的堆,最终需要由实际的交换设备来支持。
发布于 2014-05-26 04:29:31
这三个系统有很多东西,但它们之间没有一个简单的比较,更不用说很好地解释它们。我想弄明白,但我的头爆炸了。然后我以为我拿到了,于是我试着把它写下来,然后我的头又爆炸了。(参见实现摘要)我认为在这里发布这篇文章会很有用,因为有许多stackexchange问题询问它们之间的两两比较。
- **Status:** Merged into the mainline kernel 3.14. Once enabled on a system, it requires some userspace configuration to set up the swap devices and use them.frontswap系统挂钩尝试交换页面,并将zswap用作HDD/SSD交换设备的写回缓存:尝试压缩页面,如果它包含不可压缩的数据,则直接写入磁盘。如果数据被压缩,则将其存储在zswap内存池中。如果内存中的总压缩页超过一定大小时,内存中的页被交换出内存,则将最近使用最少的(LRU)压缩页写入磁盘,因为不太可能很快需要它。put和get调用一次访问一个页面。这与普通内存不同,普通内存一次可以访问一个字节。frontswap和cleancache系统钩子分别尝试交换和回收文件系统页面缓存,并将它们发送到超越性内存后端。当zcache用作后端时,数据被压缩并存储在RAM中。当它被填满时,压缩的页面将被逐出到交换区中。(另一个后端是RAMster,它在联网的计算机上共享一个内存池)。只使用frontswap前端和zcache后端,就像使用zswap一样。(实际上zswap是zcache的一个简化子集) 我找到的最好的资源是:
https://askubuntu.com/questions/471912
复制相似问题