Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
ShiningRay
V2EX  ›  Linux

Linux 3.11新增的zswap特性

  •  
  •   ShiningRay ·
    ShiningRay · Oct 30, 2013 · 7532 views
    This topic created in 4759 days ago, the information mentioned may be changed or developed.
    做内存压缩,据说和OS X Mavericks的内存压缩类似
    有没有人试用过效果?
    19 replies  •  1970-01-01 08:00:00 +08:00
    min
    min
    Oct 30, 2013
    1
    "I started using the zswap.enabled=1 kernel parameter and noticed a big improvement when waking up from hibernation on my Thinkpad X200 with 8GB RAM. The resuming process is much faster now."
    wjchen
    wjchen
    Oct 30, 2013
    2
    zram才是内存压缩,这个貌似试压缩swap。
    hcw1588
    hcw1588
    Oct 30, 2013
    3
    只想问ubuntu支持没。。。
    likuku
    likuku
    Oct 30, 2013
    4
    @hcw1588

    /boot$ grep -i "zswap" config-3.11.0-12-generic
    CONFIG_ZSWAP=y

    /boot$ uname -a
    Linux x230-kuku 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013 i686 i686 i686 GNU/Linux

    /boot$ cat /etc/issue
    Ubuntu 13.10 \n \l
    est
    est
    Oct 30, 2013❤️1
    5
    就是内存IO前面加个LZO http://lwn.net/Articles/545244/ 其实lz4还要猛点 http://code.google.com/p/lz4/
    BOYPT
    BOYPT
    Oct 30, 2013❤️1
    6
    嗯,休眠恢复非常快,转眼就打开到输入密码界面了。
    guangwong
    guangwong
    Oct 30, 2013
    7
    这个好啊。。。喜闻乐见
    guangwong
    guangwong
    Oct 30, 2013
    8
    这个在移动设备上有相关的报告么。
    min
    min
    Oct 30, 2013
    9
    @est lz4貌似是解压更快,压缩方面和lzo差不多
    ivenvd
    ivenvd
    Oct 30, 2013❤️1
    10
    zram 才是内存压缩,都用了好几年了……
    oldcai
    oldcai
    PRO
    Oct 30, 2013
    11
    @est 试了一下,
    source len: 694794
    zipped len: 143015
    lz4ed len: 246743

    zip ratio: 4.85818970038
    lz4 ratio: 1.72529454952
    ratio zip/lz4: 2.8158610376

    zip time: 0.0320677757263
    lz4 time: 0.00188302993774
    time zip/lz4: 17.0298809825

    https://gist.github.com/oldcai/7230548
    est
    est
    Oct 30, 2013
    12
    @oldcai LZ4 不是比压缩尺寸,而是比压缩/解压效率。基本上这货的解压效率超过了计算机总线带宽和内存IO带宽。。。。所以你memcpy之类的操作可以认为用了lz4是无损的。
    oldcai
    oldcai
    PRO
    Oct 30, 2013
    13
    @est 恩,是的,别误会,我也觉得lz4是极好的,也比较了一下时间~
    只是贴个数据提供下参考,刚那个结果贴错了~

    test a million repeated characters:
    source len: 1000000
    zipped len: 992
    lz4ed len: 3936

    zip ratio: 1008.06451613
    lz4 ratio: 254.06504065
    ratio zip/lz4: 3.96774193548

    zip time: 0.00992608070374
    lz4 time: 0.000288963317871
    time zip/lz4: 34.350660066
    ------------------------------
    test in real world:
    source len: 574703
    zipped len: 133373
    lz4ed len: 194073

    zip ratio: 4.3089905753
    lz4 ratio: 2.96127230475
    ratio zip/lz4: 1.45511460341

    zip time: 0.023008108139
    lz4 time: 0.00155091285706
    time zip/lz4: 14.8352036895
    est
    est
    Oct 30, 2013
    14
    @oldcai 可以计算下 MBytes/s 。这个是最有参考价值的。嗯
    oldcai
    oldcai
    PRO
    Oct 30, 2013
    15
    @est
    zip processing speed: 25.3951494393 MByte/s
    lz4 processing speed: 353.97936239 MByte/s
    processing speed lz4/zip: 13.9388572309

    zip saving space speed: 19.4990332026 MByte/s
    lz4 saving space speed: 234.369320807 MByte/s
    saving space speed lz4/zip: 12.0195354494

    恩,补充了一下。
    节约CPU或者需要高速压缩的时候,用lz4就比较合适了。
    min
    min
    Oct 30, 2013
    16
    lz4一般能跑3-500mb/s,和ssd的速度差不多
    ZFS已经可以支持用lz4算法实时压缩了,家用基本感觉不到lz4的存在
    ShiningRay
    ShiningRay
    OP
    Nov 10, 2013
    17
    @wjchen http://lwn.net/Articles/563914/ 看到有个帖子说zram合并到zswap了,没太理解
    ShiningRay
    ShiningRay
    OP
    Nov 10, 2013
    18
    @wjchen 翻了一下内核的提交日志,原来zram之前叫ramzswap,真奇怪啊
    swors
    swors
    Dec 2, 2013
    19
    @BOYPT 我开了zswap 但似乎对休眠Hibernation没啥作用
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4629 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 06:23 · PVG 14:23 · LAX 22:23 · JFK 01:23
    ♥ Do have faith in what you're doing.