Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6224092iob; Tue, 10 May 2022 13:15:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjs6mBU4asnnjZx54QozZyKgSN9YBgL1tmRxVINPVVDNpIehAH8/MGkIP0HYKRm7m5qHvL X-Received: by 2002:a63:6886:0:b0:3c5:11f4:f055 with SMTP id d128-20020a636886000000b003c511f4f055mr18339301pgc.44.1652213753806; Tue, 10 May 2022 13:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652213753; cv=none; d=google.com; s=arc-20160816; b=ANO5gyqWX7BcE7/1eGiXA4yhYj76WXMXBkGlu2HNs5RmShdvEQOI3ewKaOnLuTjtLg pDNWcct7M10uGPspGMS/erJ81fvLHcnQwaxBl06z2dc+jWrdqyHS+F8urbD1PfJj4uwc n2q0QTPBV4v/DHHqiTgi3oyo8ve6lFt5wfpXoTVzlzPq9A/x6DgDvhA7+KQVZau4Lv9G FvzBjc8KaEtiAiGyjQpNm/nISm1zAqXx/bRVyc3V4GDYZXVPJ2Q5PhggT+nZ8NS7X7W/ tZk7F8lzrPbWwDiNa4TC3aBWlogmI1Ob5uLy7afXfpVQakIbAvnLR5JqqYz0bd8KRVLt Jf/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FOe0QpIsq707T7oDbRf/pCSk/0RB38He1yJY5ChwDp8=; b=ihj5ZuNqg7s4BzyH4oiLb7Ex1okwzMEspXEN8rYri5W5HksNrlvkFBPUPvtKTp9sNT kKmF2WJNEUDjH0RW2CtTw94CaF1cemPwOtnuqz/aE6+ctYzg57i1nnZWRqHpVXq5pwKU JM8mkrG2bUyUhOkrY17X8036K8D3qFDxIAO4nmH0ytjvs18igpAAB3zypTMHS6lJWEfr lXbHcyottVSIR71vdq+mA5VbkMhKdVs5P5hXvrikhvZm0gQkRdepSyu8Zhu55pnWum7P rEMgKMMLtLQiPb4h2ZBZld+Frvrp5fe5uBkfcQ6Tx/bL9YE0NHM7p5skO2tGRzH8A0oO QKyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=aIpZsyJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056a00190c00b0050612d816e7si19808417pfi.104.2022.05.10.13.15.37; Tue, 10 May 2022 13:15:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=aIpZsyJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345798AbiEJPfS (ORCPT + 99 others); Tue, 10 May 2022 11:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345763AbiEJPeg (ORCPT ); Tue, 10 May 2022 11:34:36 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E06F52F8 for ; Tue, 10 May 2022 08:29:48 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id n8so12993971qke.11 for ; Tue, 10 May 2022 08:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FOe0QpIsq707T7oDbRf/pCSk/0RB38He1yJY5ChwDp8=; b=aIpZsyJf5arHu4Vr+y4gUngRQHnYs8ayU/4r6iHRz9x7KLZYtVJa7rzJAZVGmnN4Z3 fYqgefyNWghW0QllgfeEfAYaJuJVbjjrbIfAvLTM4KICsEiX8VT2m1BDJ8eqgfANQddd 1SS/KGzOfRACH29I2AkLAFUy9+7ibARRraCxVzuWayfHm0AhiyPNOL5p7+fFQSkziMaw BZjovDcs3K6cvmWvNL+GRHlhtldCWF65/b1GyAeIX0vlNUFoIWQUAfKs9JOeCPMCv7SX fy8df3gGpt6SG3JJ1yFO8DlhdGXLeMqt/Rawi0Dv+Z0qXe4nlEgaBobxeUeHzK86LEh/ NJoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FOe0QpIsq707T7oDbRf/pCSk/0RB38He1yJY5ChwDp8=; b=wuYQWmjui3f54kOqXgXAppJeS4JHgpDEXj94MJ/DdQ9KnhmoRUUUIHLH41ATNRh6+i ZM6wmgML71BdTXfsNR3bXfX6XjgOQvmhQGWMQ4a6rGWGA5BJEfnPDe4iVF7YNQCKhN/4 5u49wt4RStSaU6pzsFEuCLNsZGn+ORq3UlCSDXutBq7b2Fn4AAEkIOTzHeEwuj8hcm69 eGZZQ3M7KuEnvIwjnzdbzYdUR22BXwqdQJondfCgY+1retQ0eSyQFvl6eW8s//MtS8Jx Ikp1h4JMzHMx5NsgE4h2P9Ue8xzBr+LjTC7OWzFEB4/Bkqf5UdRCmgZWvz4Cj26bcbls ln+Q== X-Gm-Message-State: AOAM531KDvhuKwpLFnYxz2/0tktf2GIbe8576AjB+gFzKbxUldQJvxl0 blxoz5yInLFoI3ookZGNSe3PnA== X-Received: by 2002:a05:620a:cd7:b0:69f:b1a7:d1eb with SMTP id b23-20020a05620a0cd700b0069fb1a7d1ebmr15562058qkj.5.1652196588031; Tue, 10 May 2022 08:29:48 -0700 (PDT) Received: from localhost (cpe-98-15-154-102.hvc.res.rr.com. [98.15.154.102]) by smtp.gmail.com with ESMTPSA id l1-20020ae9f001000000b0069fd35d2abcsm8811440qkg.112.2022.05.10.08.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:29:47 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Michal Hocko , Roman Gushchin , Shakeel Butt , Seth Jennings , Dan Streetman , Minchan Kim , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v2 0/6] zswap: accounting & cgroup control Date: Tue, 10 May 2022 11:28:41 -0400 Message-Id: <20220510152847.230957-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog - Refresh and update meminfo documentation (Andrew) - Discussions around stat sharing opportunities with zram. But agreed that zswap is a cache and zram a backend that could theoretically be stacked, so they need to be understandable separately. (Minchan) Overview Zswap can consume nearly a quarter of RAM in the default configuration, yet it's neither listed in /proc/meminfo, nor is it accounted and manageable on a per-cgroup basis. This makes reasoning about the memory situation on a host in general rather difficult. On shared/cgrouped hosts, the consequences are worse. First, workloads can escape memory containment and cause resource priority inversions: a lo-pri group can fill the global zswap pool and force a hi-pri group out to disk. Second, not all workloads benefit from zswap equally. Some even suffer when memory contents compress poorly, and are better off going to disk swap directly. On a host with mixed workloads, it's currently not possible to enable zswap for one workload but not for the other. This series implements the missing global accounting as well as cgroup tracking & control for zswap backing memory: - Patch 1 refreshes the very out-of-date meminfo documentation in Documentation/filesystems/proc.rst. - Patches 2-4 clean up related and adjacent options in Kconfig. Not actual dependencies, just things I noticed during development. - Patch 5 adds meminfo and vmstat coverage for zswap consumption and activity. - Patch 6 implements per-cgroup tracking & control of zswap memory. Based on v5.18-rc4-mmots-2022-04-26-19-34-5-g5e1fdb02de7a. Documentation/admin-guide/cgroup-v2.rst | 21 ++ Documentation/filesystems/proc.rst | 161 +++++---- drivers/block/zram/Kconfig | 3 +- fs/proc/meminfo.c | 7 + include/linux/memcontrol.h | 54 +++ include/linux/swap.h | 5 + include/linux/vm_event_item.h | 4 + init/Kconfig | 123 ------- mm/Kconfig | 523 +++++++++++++++++++----------- mm/memcontrol.c | 196 ++++++++++- mm/vmstat.c | 4 + mm/zswap.c | 50 ++- 12 files changed, 753 insertions(+), 398 deletions(-)