Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752044AbdGFJ3Y (ORCPT ); Thu, 6 Jul 2017 05:29:24 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:20379 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbdGFJ3W (ORCPT ); Thu, 6 Jul 2017 05:29:22 -0400 X-AuditID: b6c32a2e-f79746d00000129a-1a-595e02efc258 Mime-Version: 1.0 Subject: Re: [PATCH v2] zswap: Zero-filled pages handling Reply-To: srividya.dr@samsung.com From: Srividya Desireddy To: Sergey Senozhatsky , Seth Jennings CC: "ddstreet@ieee.org" , "penberg@kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Dinakar Reddy Pathireddy , SHARAN ALLUR , SUNEEL KUMAR SURIMANI , JUHUN KIM , "srividya.desireddy@gmail.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20170706051959.GD7195@jagdpanzerIV.localdomain> X-Drm-Type: N,general X-EPLocale: en_US.EUC-KR X-EPWebmail-Msg-Type: personal X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Illegal-Object: Syntax error in X-Sender: address found on vger.kernel.org: X-Sender: =?utf-8?B?U2Ftc3VuZyBFbGVjdHJvbmljcxtTUkktQmFuZ2Fs?= ^-Extraneous program text X-Sender-IP: 107.108.50.76 X-Local-Sender: =?UTF-8?B?U3JpdmlkeWEgRGVzaXJlZGR5G1NSSS1CYW5nYWxvcmUtQVAgU3lzdGVt?= =?UTF-8?B?cyAxG++/ve+/veyHse+/veq5hu+/ve+/ve+/ve+/ve+/vRtU?= =?UTF-8?B?ZWNobmljYWwgTGVhZA==?= X-Global-Sender: =?UTF-8?B?U3JpdmlkeWEgRGVzaXJlZGR5G1NSSS1CYW5nYWxvcmUtQVAgU3lzdGVt?= =?UTF-8?B?cyAxG1NhbXN1bmcgRWxlY3Ryb25pY3MbVGVjaG5pY2FsIExl?= =?UTF-8?B?YWQ=?= X-Sender-Code: =?UTF-8?B?QzEwGxtDMTBJRDAxSUQwMTA4OTQ=?= Message-ID: <20170706092919epcms5p53dae183bd95cd2fa5b050f496f32aa73@epcms5p5> Date: Thu, 06 Jul 2017 09:29:19 +0000 X-CMS-MailID: 20170706092919epcms5p53dae183bd95cd2fa5b050f496f32aa73 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-CPGSPASS: Y X-CPGSPASS: Y X-MTR: 20170706092919epcms5p53dae183bd95cd2fa5b050f496f32aa73 CMS-TYPE: 105P X-Brightmail-Tracker: H4sIAAAAAAAAA1WSa0hTYRjHfXfOzo7Dwdu8PagpDYqUmlamJ/JafRhJEVSQktbQg1re2FTS PiRItmaoaIlOIbsp05k6dNokyS1Ek7wUSqUukSwXiOINU9I6HsX69uP//N7nfZ+HlyakJqEH nZyWyarSlCkySkyarL5+h+cEcdEBS80nGbvFlxkq6CSZTk0vYvpX+oXMR3M1xdgMm0KmYHFD yEyVlAqY57WNBGMe/kYxA5X5iNHXzaMIJ8Ur3YRIMV3SLVAY6+9TCuNCqUgx1zVCKYpa65Fi 0eh9QRQjDklgU5KzWZV/2HVx0tfvyRn9kluFRcWiPDQm1iKaBhwIpoVwLXL8i24wZGuitEhM S/ELBMWbRhHnSPAe+N3hzDnO+AQUDOpIjqV4H+QXNiM+DwTjRo2A0yl8FKyDKVzsgpUwtty1 pRO4lYBP/QH8VRKouDdN8uwJ7XVtiDvqiEPBbvfnY1f43DAr4hmg4ckPimdvKF82EDvOXM9j xLML3LW93873wOSvzu08BzSLz4Q8e8DEyhuSmxCwCUFpmV7AF+oQ2Ma3pWCYtXdv5RJ8DgzD 61tNSbwfese/bDtnoEM7IeDn8oH22WqCez+BfaHJ7L8zYl7Luuh/5hYeCktt3iXogG53tbp/ +uh2+9Qgoh65sRnq1ERWfTzjmFytTFVnpSXK49NTjWjrN/nJO9BGTZQFYRrJnCST81ejpUJl tjon1YKAJmQuknersdFSSYIyJ5dVpV9TZaWwagvypEmZu+SgfvSKFCcqM9mbLJvBqnaqAtrR Iw/JvF7HajQtlUzc1FNZVO3owIM7C5bzDmtUz+1gh9Ml80szkXNvb3jR8SFm+YTXqT4ztpUt GZxKwwUDh/Qa9zDZowFV5+zIWmPUpMrkE/RzxnUvaUDJtoaqi5dXccXZskirV6WD3XeyL/dS rdTxYRClWCzXfkBVuRH1MVb9SxmpTlIe8SNUauUfhzhFI0kDAAA= X-CMS-RootMailID: 20170702141959epcms5p32119c772b960e942da3a92e5a79d8c41 X-RootMTR: 20170702141959epcms5p32119c772b960e942da3a92e5a79d8c41 References: <20170706051959.GD7195@jagdpanzerIV.localdomain> <20170702141959epcms5p32119c772b960e942da3a92e5a79d8c41@epcms5p3> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1700 Lines: 39 On Wed, Jul 6, 2017 at 10:49 AM, Sergey Senozhatsky wrote: > On (07/02/17 20:28), Seth Jennings wrote: >> On Sun, Jul 2, 2017 at 9:19 AM, Srividya Desireddy >> > Zswap is a cache which compresses the pages that are being swapped out >> > and stores them into a dynamically allocated RAM-based memory pool. >> > Experiments have shown that around 10-20% of pages stored in zswap >> > are zero-filled pages (i.e. contents of the page are all zeros), but >> > these pages are handled as normal pages by compressing and allocating >> > memory in the pool. >> >> I am somewhat surprised that this many anon pages are zero filled. >> >> If this is true, then maybe we should consider solving this at the >> swap level in general, as we can de-dup zero pages in all swap >> devices, not just zswap. >> >> That being said, this is a fair small change and I don't see anything >> objectionable. However, I do think the better solution would be to do > this at a higher level. > Thank you for your suggestion. It is a better solution to handle zero-filled pages before swapping-out to zswap. Since, Zram is already handles Zero pages internally, I considered to handle within Zswap. In a long run, we can work on it to commonly handle zero-filled anon pages. > zero-filled pages are just 1 case. in general, it's better > to handle pages that are memset-ed with the same value (e.g. > memset(page, 0x01, page_size)). which includes, but not > limited to, 0x00. zram does it. > > -ss It is a good solution to extend zero-filled pages handling to same value pages. I will work on to identify the percentage of same value pages excluding zero-filled pages in Zswap and will get back. - Srividya