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.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY 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 2D2DEC2D0DA for ; Thu, 26 Dec 2019 06:57:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C749F2075E for ; Thu, 26 Dec 2019 06:57:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C749F2075E 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 18A758E0006; Thu, 26 Dec 2019 01:57:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 13B208E0001; Thu, 26 Dec 2019 01:57:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 029348E0006; Thu, 26 Dec 2019 01:56:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id DECD28E0001 for ; Thu, 26 Dec 2019 01:56:59 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 8B364181AEF15 for ; Thu, 26 Dec 2019 06:56:59 +0000 (UTC) X-FDA: 76306385358.21.scent72_3c786fccd3e49 X-HE-Tag: scent72_3c786fccd3e49 X-Filterd-Recvd-Size: 4002 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Dec 2019 06:56:54 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;MF=teawaterz@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0Tly10jd_1577343401; Received: from 30.27.116.26(mailfrom:teawaterz@linux.alibaba.com fp:SMTPD_---0Tly10jd_1577343401) by smtp.aliyun-inc.com(127.0.0.1); Thu, 26 Dec 2019 14:56:42 +0800 Content-Type: text/plain; charset=gb2312 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [RFC] memcg: Add swappiness to cgroup2 From: teawater In-Reply-To: <20191225140546.GA311630@chrisdown.name> Date: Thu, 26 Dec 2019 14:56:40 +0800 Cc: Hui Zhu , Johannes Weiner , Michal Hocko , vdavydov.dev@gmail.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Content-Transfer-Encoding: quoted-printable Message-Id: <6E9887B9-EEF7-406E-90D4-3FAEFE0A505E@linux.alibaba.com> References: <1577252208-32419-1-git-send-email-teawater@gmail.com> <20191225140546.GA311630@chrisdown.name> To: Chris Down X-Mailer: Apple Mail (2.3445.104.11) 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: > =D4=DA 2019=C4=EA12=D4=C225=C8=D5=A3=AC22:05=A3=ACChris Down = =D0=B4=B5=C0=A3=BA >=20 > Hi Hui, >=20 > Hui Zhu writes: >> Even if cgroup2 has swap.max, swappiness is still a very useful = config. >> This commit add swappiness to cgroup2. >=20 > When submitting patches like this, it's important to explain *why* you = want it and what evidence there is. For example, how should one use this = to compose a reasonable system? Why aren't existing protection controls = sufficient for your use case? Where's the data? >=20 > Also, why would swappiness be something cgroup-specific instead of = hardware-specific, when desired swappiness is really largely about the = hardware you have in your system? >=20 > I struggle to think of situations where per-cgroup swappiness would be = useful, since it's really not a workload-specific setting. Hi Chris, My thought about per-cgroup swappiness is different applications should = have different memory footprint. For example, an application does a lot of file access work in a = memory-constrained environment. Its performance depend on the file = access speed. Keep more file cache will good for it. Then more = swappiness will good for it, especially with the high speed swap = device(zram/zswap). And in the same environment, an application that access anon memory a = lot of times. Use low swapiness will good for its performance. But = just let it not to swap is not a good for it because the code is inside = file cache. Just drop the file cache will decrease the application = speed sometime. Both of them are extreme examples. Other applications maybe access both = file and anon. Maybe define a special swapiness is good for it. This is what I thought about add swappiness to cgroup2. Best, Hui >=20 > Thanks, >=20 > Chris >=20 >> Signed-off-by: Hui Zhu >> --- >> mm/memcontrol.c | 5 +++++ >> 1 file changed, 5 insertions(+) >>=20 >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c >> index c5b5f74..e966396 100644 >> --- a/mm/memcontrol.c >> +++ b/mm/memcontrol.c >> @@ -7143,6 +7143,11 @@ static struct cftype swap_files[] =3D { >> .file_offset =3D offsetof(struct mem_cgroup, = swap_events_file), >> .seq_show =3D swap_events_show, >> }, >> + { >> + .name =3D "swappiness", >> + .read_u64 =3D mem_cgroup_swappiness_read, >> + .write_u64 =3D mem_cgroup_swappiness_write, >> + }, >> { } /* terminate */ >> }; >>=20 >> --=20 >> 2.7.4 >>=20