Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753456AbcKYInd (ORCPT ); Fri, 25 Nov 2016 03:43:33 -0500 Received: from outboundhk.mxmail.xiaomi.com ([207.226.244.122]:47757 "EHLO xiaomi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754075AbcKYImF (ORCPT ); Fri, 25 Nov 2016 03:42:05 -0500 X-Greylist: delayed 952 seconds by postgrey-1.27 at vger.kernel.org; Fri, 25 Nov 2016 03:42:04 EST From: Hui Zhu To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [RFC 0/2] Add interface let ZRAM close swap cache Date: Fri, 25 Nov 2016 16:25:11 +0800 Message-ID: <1480062313-7361-1-git-send-email-zhuhui@xiaomi.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.237.10.122] X-ClientProxiedBy: CNCAS3.mioffice.cn (10.237.8.133) To cnbox6.mioffice.cn (10.237.8.146) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1990 Lines: 51 SWAP will keep before swap cache before swap space get full. It will make swap space cannot be freed. It is harmful to the system that use ZRAM because its space use memory too. This two patches will add a sysfs switch to ZRAM that open or close swap cache without check the swap space. I got good result in real environment with them. And following part is the record with vm-scalability case-swap-w-rand and case-swap-w-seq in a Intel(R) Core(TM)2 Duo CPU, 2G memory and 1G ZRAM swap machine: 4.9.0-rc5 without the patches: case-swap-w-rand 1129809600 bytes / 2149155959 usecs = 513 KB/s 1129809600 bytes / 2150796138 usecs = 512 KB/s case-swap-w-rand 1124808768 bytes / 1973130450 usecs = 556 KB/s 1124808768 bytes / 1975142661 usecs = 556 KB/s case-swap-w-rand 1130677056 bytes / 2154714972 usecs = 512 KB/s 1130677056 bytes / 2157542507 usecs = 511 KB/s case-swap-w-seq 1117922688 bytes / 6596049 usecs = 165511 KB/s 1117922688 bytes / 6715711 usecs = 162562 KB/s case-swap-w-seq 1115869824 bytes / 6909262 usecs = 157718 KB/s 1115869824 bytes / 7099283 usecs = 153496 KB/s case-swap-w-seq 1116472896 bytes / 6451638 usecs = 168996 KB/s 1116472896 bytes / 6647963 usecs = 164005 KB/s 4.9.0-rc5 with the patches: case-swap-w-rand 1127272896 bytes / 2060906184 usecs = 534 KB/s 1127272896 bytes / 2063671365 usecs = 533 KB/s case-swap-w-rand 1131846912 bytes / 2097038264 usecs = 527 KB/s 1131846912 bytes / 2100148465 usecs = 526 KB/s case-swap-w-rand 1129139136 bytes / 2038769367 usecs = 540 KB/s 1129139136 bytes / 2041411431 usecs = 540 KB/s case-swap-w-seq 1129622976 bytes / 5910625 usecs = 186638 KB/s 1129622976 bytes / 6313311 usecs = 174733 KB/s case-swap-w-seq 1130053248 bytes / 6771182 usecs = 162980 KB/s 1130053248 bytes / 6666061 usecs = 165550 KB/s case-swap-w-seq 1126484928 bytes / 6555923 usecs = 167799 KB/s 1126484928 bytes / 6642291 usecs = 165617 KB/s Hui Zhu (2): SWAP: add interface to let disk close swap cache ZRAM: add sysfs switch swap_cache_not_keep