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 48A7DC433EF for ; Wed, 11 May 2022 19:07:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A81476B0074; Wed, 11 May 2022 15:06:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A06E56B0075; Wed, 11 May 2022 15:06:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A8526B0078; Wed, 11 May 2022 15:06:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 73AD26B0074 for ; Wed, 11 May 2022 15:06:59 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 44B8A232B for ; Wed, 11 May 2022 19:06:59 +0000 (UTC) X-FDA: 79454394558.08.3542195 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by imf12.hostedemail.com (Postfix) with ESMTP id EDA8340098 for ; Wed, 11 May 2022 19:06:35 +0000 (UTC) Received: by mail-qv1-f45.google.com with SMTP id kl21so2768569qvb.9 for ; Wed, 11 May 2022 12:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=RFcLVWiWlqjohwWrz8ZmNxS2c0JbCUFp6Lb1Ilp7lsM=; b=Wqi934csibhv/mpquejGDXyoEtv7L4by8ZdjiC8Vt5xc0YCHBzZJVfZphSsZTUFtlk BWN+uBN6xJN4vfk6rYwpgxP0+Hto8wWvFVtfTc81X66yFGK+cH1Z1HReUfrgi+Yk1g8h vWplRp9WFeeKoSsIxxqRrUkTH0jt2TDkk/gNd00645n46RTD+bg1mhWdv97mtH3aF0HF yhMdAMiB2NXXE93IjVJ7yPGxLJnM429NTCqFxnYtxNrKudFgsM3k8cVwAAYJk1fp+qp5 X/r/ZbGqcqzfvRKub5gm3w23S19pd4l2vLznyNBwE9dbtRWA6EbSBXEb7cMd6sqpbwND H4/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=RFcLVWiWlqjohwWrz8ZmNxS2c0JbCUFp6Lb1Ilp7lsM=; b=2cUUzIyH3vm/0qSfVSgFAGZ4VpPmzUoBs5yL3AsApuPl1r+FVB7FjLcMgLJpwn5pzv CUQykb73weY+z3YhakzIAAui2BchIvJoFIfhIlmQmoKHkVEwzRq8i6/XXraLyJOeGB25 6iHrz0ggbNU31Mum7orEbbTyZvpA9GpkGo73+yPJqVvqXZjTYrHfdlFXmKiGnGtUdtgz FUZ6S/O/+fdPXrlRr7Ha4h5md67M6mrAsH24dStcpmwTmLtf5AcRmoc3bpaDoT/sSnH8 O1u77m492WMC/b7paY1K9H9og5xQJylpVhHejl/B9kwvzVIHVpnNYPu78bquNQA324e8 JMpQ== X-Gm-Message-State: AOAM532NtLNIv0xdPImRdf63W3KP8ZqizlbjEwUznWYh8+MMAeSpedzz Ki2Ds6KYvZYpsy7pCaVpTk1APg== X-Google-Smtp-Source: ABdhPJwN87h/5O8XKH+GeEZgluUajrgQzz3p3faqLc70d9m7twEIqgosgWojvjricOwl86yxDeE5PA== X-Received: by 2002:ad4:4ee6:0:b0:45a:fe5a:1e2c with SMTP id dv6-20020ad44ee6000000b0045afe5a1e2cmr18676356qvb.103.1652296017143; Wed, 11 May 2022 12:06:57 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:14fe]) by smtp.gmail.com with ESMTPSA id k11-20020ac8140b000000b002f39b99f6a8sm1601966qtj.66.2022.05.11.12.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 12:06:56 -0700 (PDT) Date: Wed, 11 May 2022 15:06:56 -0400 From: Johannes Weiner To: Michal =?iso-8859-1?Q?Koutn=FD?= Cc: Andrew Morton , 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: Re: [PATCH v2 6/6] zswap: memcg accounting Message-ID: References: <20220510152847.230957-1-hannes@cmpxchg.org> <20220510152847.230957-7-hannes@cmpxchg.org> <20220511173218.GB31592@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220511173218.GB31592@blackbody.suse.cz> X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: EDA8340098 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=Wqi934cs; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.45 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Rspam-User: X-Stat-Signature: opf3fkbmbemuzyqx9axefqcj81tjcdei X-HE-Tag: 1652295995-404651 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 Wed, May 11, 2022 at 07:32:18PM +0200, Michal Koutný wrote: > Hello. > > On Tue, May 10, 2022 at 11:28:47AM -0400, Johannes Weiner wrote: > > +void obj_cgroup_charge_zswap(struct obj_cgroup *objcg, size_t size) > > +{ > > + struct mem_cgroup *memcg; > > + > > + VM_WARN_ON_ONCE(!(current->flags & PF_MEMALLOC)); > > + > > + /* PF_MEMALLOC context, charging must succeed */ > > + if (obj_cgroup_charge(objcg, GFP_KERNEL, size)) > > + VM_WARN_ON_ONCE(1); > > IIUC, the objcg is derived from the compressed page, i.e. same memcg > (reparenting neglected for now). This memcg's memory.current is then > charged with the compressed object size. Correct. After which the uncompressed page is reclaimed and uncharged. So the zswapout process will reduce the charge bottom line. > Do I get it right that memory.zswap.current is a subset of memory.current? > > (And that zswap is limited both by memory.max and memory.zswap.max?) Yes. Zswap is a memory consumer, and we want the compressed part of a workload's memory to show up in the total memory footprint. memory.zswap.* are there to configure zswap policy, within the boundaries of available memory - it's by definition a subset.