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=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 A7D13C54FCB for ; Wed, 22 Apr 2020 13:30:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 371652076E for ; Wed, 22 Apr 2020 13:30:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="ryTWe4zY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 371652076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BE8908E0023; Wed, 22 Apr 2020 09:30:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B99C38E0003; Wed, 22 Apr 2020 09:30:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A88258E0023; Wed, 22 Apr 2020 09:30:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8DEAC8E0003 for ; Wed, 22 Apr 2020 09:30:05 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4D138181AC9CC for ; Wed, 22 Apr 2020 13:30:05 +0000 (UTC) X-FDA: 76735574370.18.earth88_1dc54a633720c X-HE-Tag: earth88_1dc54a633720c X-Filterd-Recvd-Size: 7654 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Wed, 22 Apr 2020 13:30:04 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id n143so2295030qkn.8 for ; Wed, 22 Apr 2020 06:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=chsAA4zyl1YPFqGtfiwU7PFfqVuSOELGokqTvQTOwpY=; b=ryTWe4zYa0wqpywa20hGmZ5UhE9d4qB5vX4YCnD9vlJUAHekQcP/Xs5IuyWY64vmU3 06wbWvSe7zfL8eU/19YZb/9DoD4Ndak8N3S8q7hkMLbR7LjpsSb78dlwwwGIocC5+WXx lalqwQ/GXib655ulKpereqvWthxeYlSjFV7icp27njo9mdQQE7IVz3FHVjFy65MkeeMW z9XwtQA2u9/g/te+NNkiFqdJx1oqOrIo1xstSpKZNFj319mN2AEGDyzeSBqSb6TltMrb C6ZZov9OETmmP7E83EE/KvMRWox8jtvqAx5kczuJgJ3mB4Fg/3mObRbzQZ8jl0r7OjmK 16gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=chsAA4zyl1YPFqGtfiwU7PFfqVuSOELGokqTvQTOwpY=; b=GC//3vSJ++6VM3e/4VWtaurEPwowC+9W+mCfzo6tPRTYqiey9lu018whGw7Q2F8EVB ozQYrv7sRWZry8a+ecouilotwF+qOfbdAoQjSSmSyYN0CcCxus1PtPr5PQnWBD4zH3Ky akM4LIWir8M/deXUpOX4ipWQTO7b+qpFoskCE8vL8oTovRXk68MUbK1jyBWN0F5snHxR ZdewTyMcXrCjBvfjZ9AC0KiJtHmvF1g75gqpigg8AHWoifVvQ+esAi7Jo4AjKUFTeJnS F+RaJDH8syD8gDEC7tgZI9gYLEQrnJpg+yLvASJjx6WZi0UEyRbQJRV4mUuF+GxIrFo7 CiSw== X-Gm-Message-State: AGi0PuYW1j8ZvqaZpaWQdrDeTof/1sNrBz/NiO0cmfv9O9VWhNUhp6PQ PnkRx9G0nZ9PG8AOmda8QnmC2Q== X-Google-Smtp-Source: APiQypI4kp0L3z8pDWk+9x1LtnDU2mTdSq+yx2OdUQxc128HJ1nrp+9d2uMLw60RNbH06M/X/I78zQ== X-Received: by 2002:a37:b445:: with SMTP id d66mr1768848qkf.474.1587562203624; Wed, 22 Apr 2020 06:30:03 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::921]) by smtp.gmail.com with ESMTPSA id g63sm3818215qkb.89.2020.04.22.06.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 06:30:02 -0700 (PDT) Date: Wed, 22 Apr 2020 09:30:01 -0400 From: Johannes Weiner To: Alex Shi Cc: Joonsoo Kim , Shakeel Butt , Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 15/18] mm: memcontrol: make swap tracking an integral part of memory control Message-ID: <20200422133001.GE358439@cmpxchg.org> References: <20200420221126.341272-1-hannes@cmpxchg.org> <20200420221126.341272-16-hannes@cmpxchg.org> <20200421143923.GC341682@cmpxchg.org> <2721c508-9b32-d0e7-454d-386129bfda1b@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2721c508-9b32-d0e7-454d-386129bfda1b@linux.alibaba.com> Content-Transfer-Encoding: quoted-printable 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, Apr 22, 2020 at 11:14:40AM +0800, Alex Shi wrote: >=20 >=20 > =E5=9C=A8 2020/4/21 =E4=B8=8B=E5=8D=8810:39, Johannes Weiner =E5=86=99=E9= =81=93: > > Hi Alex, > >=20 > > thanks for your quick review so far, I'll add the tags to the patches= . > >=20 > > On Tue, Apr 21, 2020 at 05:27:30PM +0800, Alex Shi wrote: > >> > >> > >> =E5=9C=A8 2020/4/21 =E4=B8=8A=E5=8D=886:11, Johannes Weiner =E5=86=99= =E9=81=93: > >>> The swapaccount=3D0 boot option will continue to exist, and it will > >>> eliminate the page_counter overhead and hide the swap control files= , > >>> but it won't disable swap slot ownership tracking. > >> > >> May we add extra explanation for this change to user? and the defaul= t > >> memsw limitations? > >=20 > > Can you elaborate what you think is missing and where you would like > > to see it documented? > >=20 > Maybe the following doc change is better after whole patchset?=20 > Guess users would would happy to know details of this change. Thanks, I stole your patch and extended/tweaked it a little. Would you mind providing your Signed-off-by:? >From 589d3c1b505e6671b4a9b424436c9eda88a0b08c Mon Sep 17 00:00:00 2001 From: Alex Shi Date: Wed, 22 Apr 2020 11:14:40 +0800 Subject: [PATCH] mm: memcontrol: document the new swap control behavior Signed-off-by: Johannes Weiner --- .../admin-guide/cgroup-v1/memory.rst | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentati= on/admin-guide/cgroup-v1/memory.rst index 0ae4f564c2d6..12757e63b26c 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -199,11 +199,11 @@ An RSS page is unaccounted when it's fully unmapped= . A PageCache page is unaccounted when it's removed from radix-tree. Even if RSS pages are ful= ly unmapped (by kswapd), they may exist as SwapCache in the system until th= ey are really freed. Such SwapCaches are also accounted. -A swapped-in page is not accounted until it's mapped. +A swapped-in page is accounted after adding into swapcache. =20 Note: The kernel does swapin-readahead and reads multiple swaps at once. -This means swapped-in pages may contain pages for other tasks than a tas= k -causing page fault. So, we avoid accounting at swap-in I/O. +Since page's memcg recorded into swap whatever memsw enabled, the page w= ill +be accounted after swapin. =20 At page migration, accounting information is kept. =20 @@ -222,18 +222,13 @@ the cgroup that brought it in -- this will happen o= n memory pressure). But see section 8.2: when moving a task to another cgroup, its pages may be recharged to the new cgroup, if move_charge_at_immigrate has been cho= sen. =20 -Exception: If CONFIG_MEMCG_SWAP is not used. -When you do swapoff and make swapped-out pages of shmem(tmpfs) to -be backed into memory in force, charges for pages are accounted against = the -caller of swapoff rather than the users of shmem. - -2.4 Swap Extension (CONFIG_MEMCG_SWAP) +2.4 Swap Extension -------------------------------------- =20 -Swap Extension allows you to record charge for swap. A swapped-in page i= s -charged back to original page allocator if possible. +Swap usage is always recorded for each of cgroup. Swap Extension allows = you to +read and limit it. =20 -When swap is accounted, following files are added. +When CONFIG_SWAP is enabled, following files are added. =20 - memory.memsw.usage_in_bytes. - memory.memsw.limit_in_bytes. --=20 > Also as to the RSS account name change, I don't know if it's good to po= lish > them in docs. I didn't actually change anything user-visible, just the internal name of the counters: static const unsigned int memcg1_stats[] =3D { NR_FILE_PAGES, /* was MEMCG_CACHE */ NR_ANON_MAPPED, /* was MEMCG_RSS */ NR_ANON_THPS, /* was MEMCG_RSS_HUGE */ NR_SHMEM, NR_FILE_MAPPED, NR_FILE_DIRTY, NR_WRITEBACK, MEMCG_SWAP, }; static const char *const memcg1_stat_names[] =3D { "cache", "rss", "rss_huge", "shmem", "mapped_file", "dirty", "writeback", "swap", }; Or did you refer to something else?