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 X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B5ADC433E0 for ; Fri, 8 Jan 2021 13:24:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C711723A00 for ; Fri, 8 Jan 2021 13:24:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C711723A00 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D329D8D017E; Fri, 8 Jan 2021 08:24:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CBB968D0156; Fri, 8 Jan 2021 08:24:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD1F98D017E; Fri, 8 Jan 2021 08:24:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id A31248D0156 for ; Fri, 8 Jan 2021 08:24:17 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3BF934403 for ; Fri, 8 Jan 2021 13:24:17 +0000 (UTC) X-FDA: 77682676554.27.pies79_27148de274f3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 1D7733D668 for ; Fri, 8 Jan 2021 13:24:17 +0000 (UTC) X-HE-Tag: pies79_27148de274f3 X-Filterd-Recvd-Size: 3994 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 Jan 2021 13:24:16 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1610112255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kWajWUazhZoEFj2YC1/JZm5JagKSGgfHEeGYCRfJurE=; b=gs/586IHJv6CfKBEQW6uznolaSjSS7pyS5nCShXJcGLVgCkBmUTYiKM35HqVN6LdBhjcdl GSiu4KPjhiEhosFZ+Q5uNSk690PF1Oee5aOvtgSFQcJW6Ls9/9qCRSvcUHoRLguIVpVh2C Na5hi5eVTTxjyqSzml7eMuDkWWNgBtc= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 45D47AD11; Fri, 8 Jan 2021 13:24:15 +0000 (UTC) Date: Fri, 8 Jan 2021 14:24:14 +0100 From: Michal Hocko To: Shakeel Butt Cc: Johannes Weiner , Roman Gushchin , Yang Shi , Andrew Morton , Linux MM , Cgroups , LKML Subject: Re: [PATCH] mm: memcg: add swapcache stat for memcg v2 Message-ID: <20210108132414.GD13207@dhcp22.suse.cz> References: <20210101023955.250965-1-shakeelb@google.com> <20210106145349.GN13207@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 06-01-21 08:42:39, Shakeel Butt wrote: > On Wed, Jan 6, 2021 at 6:53 AM Michal Hocko 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 -- Michal Hocko SUSE Labs