Received: by 10.213.65.68 with SMTP id h4csp2224689imn; Sun, 8 Apr 2018 22:58:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/mFwGdChttcTE2zlaFasFfgi57gxLCczwdgwHwEzzWLeEpRqG3SHmZU3mxEqHXm0OGic+2 X-Received: by 2002:a17:902:6bc3:: with SMTP id m3-v6mr36896857plt.363.1523253509303; Sun, 08 Apr 2018 22:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523253509; cv=none; d=google.com; s=arc-20160816; b=oQxtqVResoG0QUbH08tm5MB1bf+6P8203Xiy3Et48rlKqkICRXX4qtQv9MwjFpybuF b93YpCfPoQcB6yz7ysE4sdiOY/i//fJHhAla8a8kxLQ2ZYkOnDtj+E8VrSWuk+mu0mZA tR9+SNz/mnD6Uyd+SkXrw4jretpXDitM26s9p/Uz0dPq1PXOhEeoOOoUd5QBSULp2zyp cocGITr6y0pJKNwVYS6FLylxzUf6GHiJo7B4JsFXp8J9NBbH/vCf2OmU2svEM5EKsrNT WgrpgVxHOvOpTDBLcDyt35PP15bPOBIOPI4PI5BZ2IQtr9Q7x7a0VBkpOjFAy90wTm1t m3cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=wSKKLyZ0e8hyZZmEYXipz/VN2J685uinhDtBgx5Xc6E=; b=ry0oGMq7+rQY76kwVMnlGMIOTJg8/CxTErl0R99hh8FYehB8smTORAK7u5fcx7mWju V4aDQ+7SlWfc9avb5FE4+DIlYhezfb2YH0jIftVtmOfrJJqiIBT/yIIeKRD30mpwLDBj Ct7kDNyl8S0ZoV1af916gThdriIRvlGtzBJ3gjsGQRNnCf2OWkPD1Fkq1TglDFNCeEED hYqMqhWf1ri5Q/xx92EjTXKUhV03yWNqFlyCkyhWP+v5pe5Iash9KkpdNpesH5HC9uh9 irqHT9lx0phsn+yXDYzp2jhA+dAz0ojqVoOQFZRdzwnXwfAfxc5VpTC/ZrMrvgbK3Oru MvRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=aSo+qMa5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si10438978pgv.370.2018.04.08.22.57.52; Sun, 08 Apr 2018 22:58:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=aSo+qMa5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751526AbeDIFyo (ORCPT + 99 others); Mon, 9 Apr 2018 01:54:44 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44377 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbeDIFyn (ORCPT ); Mon, 9 Apr 2018 01:54:43 -0400 Received: by mail-pf0-f193.google.com with SMTP id p15so5243939pff.11 for ; Sun, 08 Apr 2018 22:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=wSKKLyZ0e8hyZZmEYXipz/VN2J685uinhDtBgx5Xc6E=; b=aSo+qMa5R9vcoA8gbxX68cC13skGplmGfLoe41ErW7q8FGatZdF0GmXQ91yVHy5thN aJ8PvUObXx7vhS25esXcOYyepO43CYd21gzhOdgd4z2u1fiCaCO1HyEjNWkBjfRhtFGt wDOu3y2H5tti0+pFC+c1U12IIKUvXq8SXNOKz1+Qfos6ZW3rAJOv7wAC3MKyQp/4TbEh KArqi7LEIcTcMvyRjgD0OFGDan5WnjmDmSs/kOop6/UzHMuwPqx1uTwuXvVVCi79Bu/N vrAphg8u0gsK1akEjkPHVoOZ04AtNvPYJmeE+f/Iq/U4wDsRL/PKpbOWM6nDmPlhRHnx +QmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=wSKKLyZ0e8hyZZmEYXipz/VN2J685uinhDtBgx5Xc6E=; b=GKXeXoQFGL/w9iuknYf9COkNNVvKiZm6amPX81QZudtlk45wV4BCfoSiT0v4WiojxA qOpj8iar8ExdTrLs40CVkrWox0M8MmvAXgbS9R1QDGEn6b+M+2AGqrEeK0Orzl8ea2L6 2TovTFMe+vb/AQzBdO0/D8yp4sQRSXU0UfwOleZQNS/xsNzp9/b0M8AUBt7ZHIVs/M0W +vMWYWyc1XanSOcL2Sqjlc8v8kDLBPn3A578FcnJwvgnxeL5U4OsQK0K2s3/SwEg7Rtg MWXJNeiEJzSEgteTjnLyFnRJ37GrFTRFtp7ZeoR7aZyYreYDrhPFb7al1vvWBr26u8US 8e4w== X-Gm-Message-State: AElRT7Gapnob4pkkNrODa6X2G4XXj6cQIQ2rNPgiGcc31eCAd51k6nNj +pVtor9OO24DCHzbLzXVkaIp51Q0 X-Received: by 10.99.114.12 with SMTP id n12mr19976392pgc.133.1523253282748; Sun, 08 Apr 2018 22:54:42 -0700 (PDT) Received: from bbox-2.seo.corp.google.com ([2401:fa00:d:0:7630:de9:f6f2:276f]) by smtp.gmail.com with ESMTPSA id z83sm31992927pfd.31.2018.04.08.22.54.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Apr 2018 22:54:41 -0700 (PDT) From: Minchan Kim To: Andrew Morton Cc: LKML , Sergey Senozhatsky , Minchan Kim Subject: [PATCH v3 0/4] zram memory tracking Date: Mon, 9 Apr 2018 14:54:31 +0900 Message-Id: <20180409055435.135695-1-minchan@kernel.org> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org zRam as swap is useful for small memory device. However, swap means those pages on zram are mostly cold pages due to VM's LRU algorithm. Especially, once init data for application are touched for launching, they tend to be not accessed any more and finally swapped out. zRAM can store such cold pages as compressed form but it's pointless to keep in memory. As well, it's pointless to store incompressible pages to zram so better idea is app developers manages them directly like free or mlock rather than remaining them on heap. This patch provides a debugfs /sys/kernel/debug/zram/zram0/block_state to represent each block's state so admin can investigate what memory is cold|incompressible|same page with using pagemap once the pages are swapped out. The output is as follows, 300 75.033841 .wh 301 63.806904 s.. 302 63.806919 ..h First column is zram's block index and 3rh one represents symbol (s: same page w: written page to backing store h: huge page) of the block state. Second column represents usec time unit of the block was last accessed. So above example means the 300th block is accessed at 75.033851 second and it was huge so it was written to the backing store. * From v2: * debugfs and Kconfig cleanup - Greg KH * Remove unnecesarry buffer - Sergey * Change timestamp from sec to usec * From v1: * Do not propagate error number for debugfs fail - Greg KH * Add writeback and hugepage information - Sergey Minchan Kim (4): zram: correct flag name of ZRAM_ACCESS zram: mark incompressible page as ZRAM_HUGE zram: record accessed second zram: introduce zram memory tracking Documentation/blockdev/zram.txt | 25 +++++ drivers/block/zram/Kconfig | 9 ++ drivers/block/zram/zram_drv.c | 172 +++++++++++++++++++++++++++++--- drivers/block/zram/zram_drv.h | 14 ++- 4 files changed, 203 insertions(+), 17 deletions(-) -- 2.17.0.484.g0c8726318c-goog