From: Johannes Weiner <hannes@cmpxchg.org> To: "Michal Koutný" <mkoutny@suse.com> Cc: Andrew Morton <akpm@linux-foundation.org>, Michal Hocko <mhocko@suse.com>, Roman Gushchin <guro@fb.com>, Shakeel Butt <shakeelb@google.com>, Seth Jennings <sjenning@redhat.com>, Dan Streetman <ddstreet@ieee.org>, Minchan Kim <minchan@kernel.org>, 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 Date: Wed, 11 May 2022 15:06:56 -0400 [thread overview] Message-ID: <YnwJUL90fuoHs3YW@cmpxchg.org> (raw) In-Reply-To: <20220511173218.GB31592@blackbody.suse.cz> 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 <hannes@cmpxchg.org> 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.
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> To: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>, Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>, Roman Gushchin <guro-b10kYP2dOMg@public.gmane.org>, Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, Seth Jennings <sjenning-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>, Dan Streetman <ddstreet-EkmVulN54Sk@public.gmane.org>, Minchan Kim <minchan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-team-b10kYP2dOMg@public.gmane.org Subject: Re: [PATCH v2 6/6] zswap: memcg accounting Date: Wed, 11 May 2022 15:06:56 -0400 [thread overview] Message-ID: <YnwJUL90fuoHs3YW@cmpxchg.org> (raw) In-Reply-To: <20220511173218.GB31592-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.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 <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> 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.
next prev parent reply other threads:[~2022-05-11 19:07 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-10 15:28 [PATCH v2 0/6] zswap: accounting & cgroup control Johannes Weiner 2022-05-10 15:28 ` Johannes Weiner 2022-05-10 15:28 ` [PATCH v2 1/6] Documentation: filesystems: proc: update meminfo section Johannes Weiner 2022-05-10 15:28 ` Johannes Weiner 2022-05-11 17:11 ` David Hildenbrand 2022-05-11 17:11 ` David Hildenbrand 2022-05-11 18:51 ` Johannes Weiner 2022-05-11 18:51 ` Johannes Weiner 2022-05-12 8:55 ` David Hildenbrand 2022-05-12 8:55 ` David Hildenbrand 2022-05-10 15:28 ` [PATCH v2 2/6] mm: Kconfig: move swap and slab config options to the MM section Johannes Weiner 2022-05-10 15:28 ` Johannes Weiner 2022-05-10 15:28 ` [PATCH v2 3/6] mm: Kconfig: group swap, slab, hotplug and thp options into submenus Johannes Weiner 2022-05-10 15:28 ` Johannes Weiner 2022-05-10 22:40 ` Andrew Morton 2022-05-10 22:40 ` Andrew Morton 2022-05-11 15:22 ` Johannes Weiner 2022-05-11 15:22 ` Johannes Weiner 2022-05-11 16:28 ` Johannes Weiner 2022-05-11 16:28 ` Johannes Weiner 2022-05-10 15:28 ` [PATCH v2 4/6] mm: Kconfig: simplify zswap configuration Johannes Weiner 2022-05-10 15:28 ` Johannes Weiner 2022-05-10 15:28 ` [PATCH v2 5/6] mm: zswap: add basic meminfo and vmstat coverage Johannes Weiner 2022-05-10 15:28 ` Johannes Weiner 2022-05-11 17:13 ` David Hildenbrand 2022-05-11 17:13 ` David Hildenbrand 2022-05-10 15:28 ` [PATCH v2 6/6] zswap: memcg accounting Johannes Weiner 2022-05-10 15:28 ` Johannes Weiner 2022-05-11 17:32 ` Michal Koutný 2022-05-11 17:32 ` Michal Koutný 2022-05-11 19:06 ` Johannes Weiner [this message] 2022-05-11 19:06 ` Johannes Weiner 2022-05-13 15:14 ` Michal Koutný 2022-05-13 15:14 ` Michal Koutný 2022-05-13 17:08 ` Johannes Weiner 2022-05-13 17:08 ` Johannes Weiner 2022-05-16 14:34 ` Michal Koutný 2022-05-16 14:34 ` Michal Koutný 2022-05-16 20:01 ` Johannes Weiner 2022-05-16 20:01 ` Johannes Weiner 2022-05-17 23:52 ` Andrew Morton 2022-05-18 8:23 ` Michal Koutný 2022-05-18 8:23 ` Michal Koutný 2022-05-13 17:23 ` Shakeel Butt 2022-05-13 17:23 ` Shakeel Butt 2022-05-13 18:25 ` Johannes Weiner 2022-05-13 18:25 ` Johannes Weiner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YnwJUL90fuoHs3YW@cmpxchg.org \ --to=hannes@cmpxchg.org \ --cc=akpm@linux-foundation.org \ --cc=cgroups@vger.kernel.org \ --cc=ddstreet@ieee.org \ --cc=guro@fb.com \ --cc=kernel-team@fb.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@suse.com \ --cc=minchan@kernel.org \ --cc=mkoutny@suse.com \ --cc=shakeelb@google.com \ --cc=sjenning@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.