Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp233781iob; Wed, 11 May 2022 13:14:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkbIyRD70TCH27ZGuJdOEEqM94ZqPGIOWziN8TgHPD/D2K94IdRAOsPw2fM8J6anpKesas X-Received: by 2002:a17:907:968d:b0:6f4:9f9e:3e5f with SMTP id hd13-20020a170907968d00b006f49f9e3e5fmr26945734ejc.540.1652300049443; Wed, 11 May 2022 13:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652300049; cv=none; d=google.com; s=arc-20160816; b=fJ11HyvANBWhIr7ZOxavNp8pb2SFlYPCgdTwREPCHARaZh0PkSVPgBLgcs48+VGIAd d2kLDGmLb5DqkWcQrJJ7hO/+azs+ATHUDBsT895UqF7LRHX0xw4XCfAlQwsuPmXlSYU+ WMg9sbrrzP/vuACjHlbkpKYurmQUxJa20WrYb11IJ8Rb4LnBi2ljH0JL4Cems2ifyie2 FVn8s1/yF7W5n3fWKXPLg0G8M2851Ey6PXkV3HfCIYMjTuqhlf8aNqjGRvU1XJhYLRSK tWa0Piq07+rWoIexv1EFA5NGvqr9zbVNo632oRMES/kVAvveTMzoAbENu+WIUi6QrxHy 1SyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RFcLVWiWlqjohwWrz8ZmNxS2c0JbCUFp6Lb1Ilp7lsM=; b=Gl5VqM+G2SYJXZZS2OsYTKXmZOMQpyqxfhxLDqPaIf0qndzvjHqzb1kqFvI5T/HYdo cncGTd+2LnloqsSv8tMtwHwNq9FK9WPSsTiBYZGI4TEiLQW299gFoh0/ZSdLAdfirE9S J9NfIz7s2K15La3/WlRinxF4lzGzX9mModTlNXHoP+IbGmockH4Cd4k3O12/6ywShWks 14+i7YwUDiEsa4vjaFeQdcR2ZJ4IimwJj+ggNsZ3sYq9P8+8NW5xeYBeW7AAmiNkVW4p Cy9yGNVeJNs4pnY0dLGh5ar8Iok4vpxHLopjy5ulmi724Uv/Og8LAwVHIPKpRkVn4HIw Hc2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=Wqi934cs; 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 d1-20020a50ea81000000b00418c2b5beb9si3097963edo.411.2022.05.11.13.13.23; Wed, 11 May 2022 13:14:09 -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=Wqi934cs; 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 S240092AbiEKTHC (ORCPT + 99 others); Wed, 11 May 2022 15:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237377AbiEKTHB (ORCPT ); Wed, 11 May 2022 15:07:01 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E45769716 for ; Wed, 11 May 2022 12:06:58 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id dv4so2758319qvb.13 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=N+WOLY//zyaEUogVSua+lyKJE7PUENAy6org6KlawFY+evL7lG693ApZVDCdWTtb9R bbSGCp7hci2ADxjzMAzuXDvBtAxOSdjzwyTt8+XbcBFlUIRBGbmkOHUcokAoqRr9Wtdp Qs2neq/rs6cb2lkA87GE4lZkncqbhQyB7tSDzTgYnld5A9mc04SiTwbTdTJV1xjRHuz7 2jfXdeXLhFr1rTxZVXb1d3e8mKLnn9O0RFewLrFmhCaDh26PQzZPYJhRBFuWvqa+QXLs W5MWo0NW9R0a7e4Xrs2dPXMatORuHf5ItG8iUoPnLOprVQNzKn9P4EBAxihNzYwZlD+x xjFA== X-Gm-Message-State: AOAM533f8OeluX1UjgzdDY1Ikc1ZKXAwHWUJ3rirlOYDmQ6+GQG0pQq1 qKSTkmRRf18WgEXKmPTCuEmznQ== 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-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=ham 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 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.