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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_SANE_1 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 E9C83C54FCB for ; Wed, 22 Apr 2020 13:41:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B825120774 for ; Wed, 22 Apr 2020 13:41:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B825120774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 529838E0024; Wed, 22 Apr 2020 09:41:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D94D8E0003; Wed, 22 Apr 2020 09:41:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EF6B8E0024; Wed, 22 Apr 2020 09:41:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 2884E8E0003 for ; Wed, 22 Apr 2020 09:41:52 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C4A84180AD822 for ; Wed, 22 Apr 2020 13:41:51 +0000 (UTC) X-FDA: 76735604022.09.fuel60_847295078c24d X-HE-Tag: fuel60_847295078c24d X-Filterd-Recvd-Size: 5561 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Wed, 22 Apr 2020 13:41:49 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0TwKjoiT_1587562901; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TwKjoiT_1587562901) by smtp.aliyun-inc.com(127.0.0.1); Wed, 22 Apr 2020 21:41:42 +0800 Subject: Re: [PATCH 15/18] mm: memcontrol: make swap tracking an integral part of memory control To: Johannes Weiner 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 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> <20200422133001.GE358439@cmpxchg.org> From: Alex Shi Message-ID: <66573da2-f863-bf6e-cc48-fb2540148d1d@linux.alibaba.com> Date: Wed, 22 Apr 2020 21:40:28 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200422133001.GE358439@cmpxchg.org> Content-Type: text/plain; charset=utf-8 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: =E5=9C=A8 2020/4/22 =E4=B8=8B=E5=8D=889:30, Johannes Weiner =E5=86=99=E9=81= =93: > On Wed, Apr 22, 2020 at 11:14:40AM +0800, Alex Shi wrote: >> >> >> =E5=9C=A8 2020/4/21 =E4=B8=8B=E5=8D=8810:39, Johannes Weiner =E5=86=99= =E9=81=93: >>> Hi Alex, >>> >>> thanks for your quick review so far, I'll add the tags to the patches= . >>> >>> 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? >>> >>> Can you elaborate what you think is missing and where you would like >>> to see it documented? >>> >> Maybe the following doc change is better after whole patchset?=20 >> Guess users would would happy to know details of this change. >=20 > Thanks, I stole your patch and extended/tweaked it a little. Would you > mind providing your Signed-off-by:? My pleasure. :) Signed-off-by: Alex Shi >=20 > 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 >=20 > Signed-off-by: Johannes Weiner > --- > .../admin-guide/cgroup-v1/memory.rst | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) >=20 > diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documenta= tion/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 unmapp= ed. A PageCache page is > unaccounted when it's removed from radix-tree. Even if RSS pages are f= ully > unmapped (by kswapd), they may exist as SwapCache in the system until = they > 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 onc= e. > -This means swapped-in pages may contain pages for other tasks than a t= ask > -causing page fault. So, we avoid accounting at swap-in I/O. > +Since page's memcg recorded into swap whatever memsw enabled, the page= will > +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= on memory pressure). > But see section 8.2: when moving a task to another cgroup, its pages m= ay > be recharged to the new cgroup, if move_charge_at_immigrate has been c= hosen. > =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 agains= t 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= is > -charged back to original page allocator if possible. > +Swap usage is always recorded for each of cgroup. Swap Extension allow= s 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