lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 8 Jan 2021 14:24:14 +0100
From:   Michal Hocko <mhocko@...e.com>
To:     Shakeel Butt <shakeelb@...gle.com>
Cc:     Johannes Weiner <hannes@...xchg.org>, Roman Gushchin <guro@...com>,
        Yang Shi <shy828301@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux MM <linux-mm@...ck.org>,
        Cgroups <cgroups@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: memcg: add swapcache stat for memcg v2

On Wed 06-01-21 08:42:39, Shakeel Butt wrote:
> On Wed, Jan 6, 2021 at 6:53 AM Michal Hocko <mhocko@...e.com> wrote:
> >
> > On Thu 31-12-20 18:39:55, Shakeel Butt wrote:
> > > This patch adds swapcache stat for the cgroup v2. The swapcache
> > > represents the memory that is accounted against both the memory and the
> > > swap limit of the cgroup. The main motivation behind exposing the
> > > swapcache stat is for enabling users to gracefully migrate from cgroup
> > > v1's memsw counter to cgroup v2's memory and swap counters.
> > >
> > > Cgroup v1's memsw limit allows users to limit the memory+swap usage of a
> > > workload but without control on the exact proportion of memory and swap.
> > > Cgroup v2 provides separate limits for memory and swap which enables
> > > more control on the exact usage of memory and swap individually for the
> > > workload.
> > >
> > > With some little subtleties, the v1's memsw limit can be switched with
> > > the sum of the v2's memory and swap limits. However the alternative for
> > > memsw usage is not yet available in cgroup v2. Exposing per-cgroup
> > > swapcache stat enables that alternative. Adding the memory usage and
> > > swap usage and subtracting the swapcache will approximate the memsw
> > > usage. This will help in the transparent migration of the workloads
> > > depending on memsw usage and limit to v2' memory and swap counters.
> >
> > Could you expand a bit more on why memsw usage is important even in
> > cgroup v2 land? How are you going to use the approximated value?
> >
> 
> Two main benefits. First, it hides the underlying system's swap setup
> from the applications. Applications with multiple instances running in
> a datacenter with heterogeneous systems (some have swap and some
> don't) will keep seeing a consistent view of their usage.
> 
> Second, most of the applications (at least in our prod) are not really
> interested in two separate memory and swap usage metrics. A single
> usage metric is more simple to use and reason about for these
> applications.

OK fair enough. Thanks for the clarification.

As I've said I do not see any problem with exporting the counter.

Acked-by: Michal Hocko <mhocko@...e.com>

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists