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 BA592C433EF for ; Wed, 27 Apr 2022 16:01:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7CBB16B0075; Wed, 27 Apr 2022 12:01:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 751606B0078; Wed, 27 Apr 2022 12:01:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 598746B007D; Wed, 27 Apr 2022 12:01:07 -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 403C66B0078 for ; Wed, 27 Apr 2022 12:01:07 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 20338155F for ; Wed, 27 Apr 2022 16:01:07 +0000 (UTC) X-FDA: 79403122974.19.2EA03BC Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf20.hostedemail.com (Postfix) with ESMTP id 3C7831C0088 for ; Wed, 27 Apr 2022 16:00:54 +0000 (UTC) Received: by mail-qk1-f173.google.com with SMTP id z126so1624636qkb.2 for ; Wed, 27 Apr 2022 09:00:57 -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=9GL3COHv0leHgkc2xj8IFg2MOsyvROczlu9iqFQTi6c=; b=EyNosu86WZBzUC9jjE+BB/6+rRUePVNB5D6ZLweYK0cFIUWcYSagiZotbV3kGhvIlS aSvmf4EfGitZgrEkXNDGgBgiz1HC8zvbqhEgPDUnOPd4hguA+FT8asyo6S3j5oDYIoGo 8i8blQjc96SokqKzFW3yhgqj9t2hCvOPMNnicEa5sb4XEiaLxO8ipgY23jPrzflTCMCj e/QXaswu/EhhZnxUl3ooWdUkmRJ2DPmY42IUXuA03tcMHr/j8BJn49Zny7U2+x5RZUMc 5GK7mdC+N0Gj6dvbpJN0oMAU2pAmBPbv0TW1TyQBbPT7Db08uuswrZhBl7kJzgp+QWcy Qw3w== 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=9GL3COHv0leHgkc2xj8IFg2MOsyvROczlu9iqFQTi6c=; b=ptExBcMdfR5oi8/bcda4wlK3DNILgk880JByxvgGiJZEZ5CNfJv1VjRspvzHd/4bVX /AOX5P8i/DcpfDyKI+9u83oopCYWGF18WO9pIzZImsOdSYkswpEFXZ+cWfavT/I6WT2V TnxdaxvDrqJIknhrNL1gZrbKEQt7Z8XTskwXsv/x0lHLESrdpvl6YWDx8B369v7Kkvnj rpBFeMhtBQFnJFiOghuc4uDbLwYMcr5g5EDWxOtOZAV0DjErG8v/mW7QZhPLfxuc6/aD Sk+dy2j1lQa/sCHclQ1dL/8Ed5uTuDd3+XRY2I45FvbzGhJjr6Vz58KDtfiLJIz5l64Q CXFw== X-Gm-Message-State: AOAM531LD6yh/4I0LqEGsQWsQB8ZKaPqmIDxM/mX9l3F8h9hQ6PfLehk IuU2BSI18SsmAJk+hJ1IrMaUUw== X-Google-Smtp-Source: ABdhPJxf17+/YxgQAbE/TSRufq++NTLpwlkrr6HcG5ZWLe4C60zjvMCj2EQOO6Z99OmnWn9WV/8HRA== X-Received: by 2002:a05:620a:404f:b0:69f:1160:73e6 with SMTP id i15-20020a05620a404f00b0069f116073e6mr16720445qko.690.1651075256344; Wed, 27 Apr 2022 09:00:56 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:f617]) by smtp.gmail.com with ESMTPSA id v67-20020a376146000000b0069ec181a0c6sm8304072qkb.10.2022.04.27.09.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 09:00:56 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: 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: [PATCH 0/5] zswap: cgroup accounting & control Date: Wed, 27 Apr 2022 12:00:11 -0400 Message-Id: <20220427160016.144237-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3C7831C0088 X-Stat-Signature: 6fd3i4rcke3q4tuwmkb61gsbeqd4pu3k X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=EyNosu86; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.173 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=temperror reason="query timed out" header.from=cmpxchg.org (policy=temperror) X-HE-Tag: 1651075254-405799 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: Zswap backing memory is currently not tracked (and limited) on a per-cgroup basis. As a result, workloads can escape their memory containment and cause resource priority inversions on a shared host. E.g. a lo-pri group fills the global zswap pool and forces a hi-pri group out to disk. Also, zswap doesn't benefit all workloads 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 missing cgroup awareness and control for zswap to address both issues. More details on interface and implementation in patch 5. Patches 1-3 clean up related and adjacent options in Kconfig. Not dependencies, just things I noticed during development. Based on v5.18-rc4-mmots-2022-04-26-19-34-5-g5e1fdb02de7a. Documentation/admin-guide/cgroup-v2.rst | 21 ++ 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 ++- 11 files changed, 648 insertions(+), 342 deletions(-)