Documentation/vm/zswap.txt

Chinese translated version of Documentation/vm/zswap.txt

If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.

Chinese maintainer:Luo Yangyang <794436342@qq.com>
---------------------------------------------------------------------
Documentation/vm/zswap.txt的中文翻译

如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。

中文版维护者: 罗秧秧  <794436342@qq.com>
中文版翻译者: 罗秧秧  <794436342@qq.com>
中文版校译者: 罗秧秧  <794436342@qq.com>

以下为正文
---------------------------------------------------------------------

Overview:


Zswap is a lightweight compressed cache for swap pages. It takes pages that 
are in the process of being swapped out and attempts to compress them into a
dynamically allocated RAM-based memory pool.  zswap basically trades CPU 
cycles for potentially reduced swap I/O.  This trade-off can also result in a
significant performance improvement if reads from the compressed cache are
faster than reads from a swap device.

概述:

Zswap是一个轻量级的压缩缓存交换页。这使得页面处于
被换出过程中,并且试图将页面压缩成一个
动态分配的基于RAM的内存缓冲池。zswap为了尽可能地减少I/O的交换,
主要交换CPU周期。如果从压缩缓存读取
速度比从交换设备读取要快时,这种交换也能产生
显著地的性能改善的结果。

NOTE: Zswap is a new feature as of v3.11 and interacts heavily with memory
reclaim.  This interaction has not be fully explored on the large set of
potential configurations and workloads that exist.  For this reason, zswap
is a work in progress and should be considered experimental.

注:截止到版本v3.11,Zswap是一项新功能,与内存
回收相互紧密配合。这种相互作用并没有在存在的
潜在配置和工作负载上进行充分的探索。出于这个原因,zswap
是一个进展中的工作,并应该被考虑成是实验性的。

Some potential benefits:
* Desktop/laptop users with limited RAM capacities can mitigate the
    performance impact of swapping.
* Overcommitted guests that share a common I/O resource can
    dramatically reduce their swap I/O pressure, avoiding heavy handed I/O
    throttling by the hypervisor. This allows more work to get done with less
    impact to the guest workload and guests sharing the I/O subsystem.
* Users with SSDs as swap devices can extend the life of the device by
    drastically reducing life-shortening writes.

一些潜在的好处:
* 台式机/笔记本电脑用户提供有限的内存容量,可以减轻
  交换性能的影响。
* 共享一个共同的I/O资源的过载来宾账户可以
  显著降低其交换I/O的压力,避免虚拟机管理程序进行大量地掌管
  I/O节流。这允许在对来宾账户的工作量和共享I/O子系统影响更小
  的前提下做更多的工作。
* 使用固态硬盘作为交换设备的用户可以通过大大减少缩短寿命的写操作
  来延长设备的使用寿命。

Zswap evicts pages from compressed cache on an LRU basis to the backing swap
device when the compressed pool reaches it size limit.  This requirement had
been identified in prior community discussions.

当压缩池达到它的大小限制时,Zswap将页面从以最少使用页面置换
算法为基础的压缩高速缓存驱逐到支持交换设备。
这要求有已在之前的社会团体讨论中被确定。

To enabled zswap, the "enabled" attribute must be set to 1 at boot time.  e.g.
zswap.enabled=1

要启用zswap,“enabled”(“已启用”)这个属性必须要在开机的时候被设置为1。
例如zswap.enabled = 1

Design:

Zswap receives pages for compression through the Frontswap API and is able to
evict pages from its own compressed pool on an LRU basis and write them back 
to the backing swap device in the case that the compressed pool is full.

设计:

在压缩池已满的情况下,zswap通过Frontswap 应用程序编程接口接收
页面压缩,并能将页面从以最少使用页面置换
算法为基础的压缩高速缓存驱逐、写回到支持交换设备,

Zswap makes use of zbud for the managing the compressed memory pool.  Each
allocation in zbud is not directly accessible by address.  Rather, a handle is
return by the allocation routine and that handle must be mapped before being
accessed.  The compressed memory pool grows on demand and shrinks as 
compressed pages are freed.  The pool is not preallocated.

Zswap使用zbud管理压缩的内存池。在zbud中的每
次分配不能以地址直接访问。相反,手柄
必须被分配程序返回,并且手柄必须在
被访问前被映射。压缩内存池在需求上增长,在页面被释放时
收缩。该池是不会预先分配的。

When a swap page is passed from frontswap to zswap, zswap maintains a mapping
of the swap entry, a combination of the swap type and swap offset, to the zbud
handle that references that compressed swap page.  This mapping is achieved
with a red-black tree per swap type.  The swap offset is the search key for 
the tree nodes.

当一个交换页面从frontswap被传递到zswap时,zswap维持一个
有交换项,结合交换类型和交换偏移量,引用压缩交换页的
zbud手柄的这样一个映射。红黑树的每个交换类型
使这个映射得以实现。交换偏移量是树节点的搜索关键字。

During a page fault on a PTE that is a swap entry, frontswap calls the zswap
load function to decompress the page into the page allocated by the page fault
handler.

在一个页面故障在页表(一个交换项)上时,frontswap调用zswap的
加载函数来解压页到被页故障处理器分配的页当中去。

Once there are no PTEs referencing a swap page stored in zswap (i.e. the count
in the swap_map goes to 0) the swap code calls the zswap invalidate function,
via frontswap, to free the compressed entry.

一旦没有任何的页表引用存储在zswap中的交换页(即在swap_map中的
计数变为0)时,交换代码通过frontswap调用zswap的无效功能,
释放压缩项。

Zswap seeks to be simple in its policies.  Sysfs attributes allow for one user
controlled policies:
* max_pool_percent - The maximum percentage of memory that the compressed
    pool can occupy.

Zswap在其方针上力求简单。虚拟文件系统sysfs属性允许一个用户
控制的策略:
* max_pool_percent - 压缩池可以占据的内存的
   最大百分比。

Zswap allows the compressor to be selected at kernel boot time by setting the
“compressor” attribute.  The default compressor is lzo.  e.g.
zswap.compressor=deflate

Zswap允许压缩机在内核启动时通过设置
“compressor”(“压缩机”)属性被选中。默认的压缩机是LZO数据压缩算法。例如
zswap.compressor=deflate   (缩小)

A debugfs interface is provided for various statistic about pool size, number
of pages stored, and various counters for the reasons pages are rejected.

debugfs(一种用于内核调试的虚拟文件系统)接口被提供是为了对有关
池大小,页存储量,以及各种统计页面被拒绝的原因的计数器
做的各种数据的统计。

将QT += core QT -= gui CONFIG += c++11 TARGET = UavRectifyLoadLIb CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS win32{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../../RasterManager/bin/Debug } else{ DESTDIR = $$PWD/../../../../RasterManager/bin/release } INCLUDEPATH += $$PWD/../../../include/gdal1101 DEPENDPATH += $$PWD/../../../include/gdal1101 } else{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../product/release32 } else{ DESTDIR = $$PWD/../../../product/release32 } } # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lUAVAutoRectifyMt -lUAVAutoRectify -lUAVAutoRectifyFi INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_core unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_imgproc INCLUDEPATH += $$PWD/../../../lib/opencvf249 DEPENDPATH += $$PWD/../../../lib/opencvf249 unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_core #unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgproc unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_features2d unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgcodecs INCLUDEPATH += $$PWD/../../../../../../../usr/local/include DEPENDPATH += $$PWD/../../../../../../../usr/local/include unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lDEMDriver unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lProjection unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lIImage_gC QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO 转为cmake格式
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值