From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73BC2C433F5 for ; Thu, 28 Apr 2022 16:59:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0494E8D0011; Thu, 28 Apr 2022 12:59:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3A5F8D000F; Thu, 28 Apr 2022 12:59:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E023D8D0011; Thu, 28 Apr 2022 12:59:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id D2AB48D000F for ; Thu, 28 Apr 2022 12:59:57 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9CCFA2AD2B for ; Thu, 28 Apr 2022 16:59:57 +0000 (UTC) X-FDA: 79406900034.05.A4CA07A Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf02.hostedemail.com (Postfix) with ESMTP id B79C78006D for ; Thu, 28 Apr 2022 16:59:53 +0000 (UTC) Received: by mail-pf1-f172.google.com with SMTP id y14so4747991pfe.10 for ; Thu, 28 Apr 2022 09:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZDYp2Y77Y0buY8pwqMtyLcOAE+45dX/zsVX064x7LX0=; b=T5FFCS6UotdYG74iCBtYERNBWBj0bDr3newq9MZ2CU9iAU7Mvp0pkO5CiXjERw7Z4h dtH/fRg2OWCurCYY/v6eAgs86zEARY/k+6a8gV+KFp5cnuwhIc+5wD3LrAQy89ZpYjGn zh4XBjGCMww1+wmz3wu4aESExAsU5U3STiPkEsu5tnyY86NbVyZRjEGc1jDnJahB9RoI akO6N05QtWT7jO5Nq0Op+bDPxkkBcZqWYPxqRyT/l6r+xlIU6CgdduGLX8sp2gwYd8TJ 5Y4/YsTIot25E8QLmvce9ubCcCd/jkHViC+wf9ZWxyci0PT7D76bJhMzp9dpPEi16tdZ /xvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=ZDYp2Y77Y0buY8pwqMtyLcOAE+45dX/zsVX064x7LX0=; b=wVqTEK4hZwt/ztcEz1kB1CREnCpG/MtPxkp58V0CJBmfGGdwDiVHU3DfpQHQwny+iU Qj1AfGUPfmzFOb3cuKEIfG38RgzOe+MmtvI7B447E7c5bfGWrtbe8Z/i6B7dQ05TWgO0 A0jG6IMN5iwuHG9UyMHb5tg2jl0iiTSbfec/fBY8ix7Ip779PnGTrZzBjMeTAN88ObH0 70FJYiJ2I7gAnKwgaoszU6254UXO+cB6sRnsLRwN6IOYSJtviBtNAjhoX7GJA8pKiK+u k5sH0w7C5Oi/q3Vv0bqx3wSjQjCNbzR9vUVzHVLCCCaIuEu5yWzsr4YispD0MUW5VrC9 31bA== X-Gm-Message-State: AOAM532QoiqocSIhG1Np5bkX5crFXQVfp4uzhB5sKpwQXGi/N71gDvXd 1b7JtnDp+cnpnSpbO+MazoY= X-Google-Smtp-Source: ABdhPJwPPcw3VwBhysd0ZeuGi4yi13I/NUSthjo0ZKPGjaYuM6U1k+/xijgpEn8AmcNANaQZXubH8w== X-Received: by 2002:aa7:9f1d:0:b0:50d:3ae5:9cac with SMTP id g29-20020aa79f1d000000b0050d3ae59cacmr23636951pfr.9.1651165196014; Thu, 28 Apr 2022 09:59:56 -0700 (PDT) Received: from google.com ([2620:15c:211:201:dc95:713b:f72c:4ad4]) by smtp.gmail.com with ESMTPSA id x126-20020a628684000000b0050d3f600ed0sm379077pfd.40.2022.04.28.09.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 09:59:55 -0700 (PDT) Date: Thu, 28 Apr 2022 09:59:53 -0700 From: Minchan Kim To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , Seth Jennings , Dan Streetman , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 4/5] mm: zswap: add basic meminfo and vmstat coverage Message-ID: References: <20220427160016.144237-1-hannes@cmpxchg.org> <20220427160016.144237-5-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: B79C78006D X-Stat-Signature: kx719c8986tecwp74o4xrotd3jrf95fq Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=T5FFCS6U; spf=pass (imf02.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.210.172 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-HE-Tag: 1651165193-186571 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Apr 28, 2022 at 10:25:59AM -0400, Johannes Weiner wrote: > On Wed, Apr 27, 2022 at 03:16:48PM -0700, Minchan Kim wrote: > > On Wed, Apr 27, 2022 at 05:20:29PM -0400, Johannes Weiner wrote: > > > On Wed, Apr 27, 2022 at 01:29:34PM -0700, Minchan Kim wrote: > > > > Hi Johannes, > > > > > > > > On Wed, Apr 27, 2022 at 12:00:15PM -0400, Johannes Weiner wrote: > > > > > Currently it requires poking at debugfs to figure out the size and > > > > > population of the zswap cache on a host. There are no counters for > > > > > reads and writes against the cache. As a result, it's difficult to > > > > > understand zswap behavior on production systems. > > > > > > > > > > Print zswap memory consumption and how many pages are zswapped out in > > > > > /proc/meminfo. Count zswapouts and zswapins in /proc/vmstat. > > > > > > > > > > Signed-off-by: Johannes Weiner > > > > > --- > > > > > fs/proc/meminfo.c | 7 +++++++ > > > > > include/linux/swap.h | 5 +++++ > > > > > include/linux/vm_event_item.h | 4 ++++ > > > > > mm/vmstat.c | 4 ++++ > > > > > mm/zswap.c | 13 ++++++------- > > > > > 5 files changed, 26 insertions(+), 7 deletions(-) > > > > > > > > > > diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c > > > > > index 6fa761c9cc78..6e89f0e2fd20 100644 > > > > > --- a/fs/proc/meminfo.c > > > > > +++ b/fs/proc/meminfo.c > > > > > @@ -86,6 +86,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v) > > > > > > > > > > show_val_kb(m, "SwapTotal: ", i.totalswap); > > > > > show_val_kb(m, "SwapFree: ", i.freeswap); > > > > > +#ifdef CONFIG_ZSWAP > > > > > + seq_printf(m, "Zswap: %8lu kB\n", > > > > > + (unsigned long)(zswap_pool_total_size >> 10)); > > > > > + seq_printf(m, "Zswapped: %8lu kB\n", > > > > > + (unsigned long)atomic_read(&zswap_stored_pages) << > > > > > + (PAGE_SHIFT - 10)); > > > > > +#endif > > > > > > > > I agree it would be very handy to have the memory consumption in meminfo > > > > > > > > https://lore.kernel.org/all/YYwZXrL3Fu8%2FvLZw@google.com/ > > > > > > > > If we really go this Zswap only metric instead of general term > > > > "Compressed", I'd like to post maybe "Zram:" with same reason > > > > in this patchset. Do you think that's better idea instead of > > > > introducing general term like "Compressed:" or something else? > > > > > > I'm fine with changing it to Compressed. If somebody cares about a > > > more detailed breakdown, we can add Zswap, Zram subsets as needed. > > > > Thanks! Please consider ZSWPIN to rename more general term, too. > > That doesn't make sense to me. > > Zram is a swap backend, its traffic is accounted in PSWPIN/OUT. Zswap > is a writeback cache on top of the swap backend. It has pages > entering, refaulting, and being written back to the swap backend > (PSWPOUT). A zswpout and a zramout are different things. Think about that system has two swap devices (storage + zram). I think it's useful to know how many swap IO comes from zram and rest of them are storage.