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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 B90D0C433ED for ; Tue, 6 Apr 2021 07:21:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3A3FA6138B for ; Tue, 6 Apr 2021 07:21:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A3FA6138B 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 A14F76B007E; Tue, 6 Apr 2021 03:21:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C52C6B0080; Tue, 6 Apr 2021 03:21:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 865146B0081; Tue, 6 Apr 2021 03:21:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 6B7D66B007E for ; Tue, 6 Apr 2021 03:21:54 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 24FF66C1D for ; Tue, 6 Apr 2021 07:21:54 +0000 (UTC) X-FDA: 78001097748.17.3A32513 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf02.hostedemail.com (Postfix) with ESMTP id 974F740002C4 for ; Tue, 6 Apr 2021 07:21:46 +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=1617693712; 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=NaYy0uWjn0czkuwfMwjR10jkixk+b1OEP4FSJKarE1w=; b=MNy/qD2vSam5wmc2g3CJoNcqtIq/nerZnfEURI68VwMgPi6w4o27wdnsCAoQ44FdWE88T1 CF9XZmIsDWftPUnopfkSfL7lMD5yVmfZBkEU6qX89FYNVuPnkxHC3V9h3djqING0Xh7orQ m9Bmqn4lFIn4wF7A2HzHXr/P0nDzP+8= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B6AAFB090; Tue, 6 Apr 2021 07:21:52 +0000 (UTC) Date: Tue, 6 Apr 2021 09:21:51 +0200 From: Michal Hocko To: Neil Sun Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/vmscan.c: drop_slab_node with task's memcg Message-ID: References: <1617359934-7812-1-git-send-email-neilsun@yunify.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1617359934-7812-1-git-send-email-neilsun@yunify.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 974F740002C4 X-Stat-Signature: m18qztx5s3pitb69r3171uhz1zycky6h Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617693706-539321 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 Fri 02-04-21 18:38:54, Neil Sun wrote: > This patch makes shrink_slab() with task's memcg in drop_slab_node(), > so we can free reclaimable slab objects belongs to memcg /lxc/i-vbe1u8o7 > with following command: You are changing semantic of the existing user interface. This knob has never been memcg aware and it is supposed to have a global impact. I do not think we can simply change that without some users being surprised or even breaking them. > cgexec -g memory:/lxc/i-vbe1u8o7 sysctl vm.drop_caches=2 > > Test with following steps: > > root@i-yl0pwrt8:~# free -h > total used free shared buff/cache available > Mem: 62Gi 265Mi 62Gi 1.0Mi 290Mi 61Gi > Swap: 31Gi 0B 31Gi > root@i-yl0pwrt8:~# (cd /tmp && /root/generate_slab_cache) > root@i-yl0pwrt8:~# free -h > total used free shared buff/cache available > Mem: 62Gi 266Mi 60Gi 1.0Mi 2.2Gi 61Gi > Swap: 31Gi 0B 31Gi > root@i-yl0pwrt8:~# cgcreate -g memory:/lxc/i-vbe1u8o7 > root@i-yl0pwrt8:~# cgexec -g memory:/lxc/i-vbe1u8o7 /root/generate_slab_cache > root@i-yl0pwrt8:~# free -h > total used free shared buff/cache available > Mem: 62Gi 267Mi 58Gi 1.0Mi 4.1Gi 61Gi > Swap: 31Gi 0B 31Gi > root@i-yl0pwrt8:~# cgexec -g memory:/lxc/i-vbe1u8o7 sysctl vm.drop_caches=2 > vm.drop_caches = 2 > root@i-yl0pwrt8:~# free -h > total used free shared buff/cache available > Mem: 62Gi 268Mi 60Gi 1.0Mi 2.2Gi 61Gi > Swap: 31Gi 0B 31Gi > root@i-yl0pwrt8:~# sysctl vm.drop_caches=2 > vm.drop_caches = 2 > root@i-yl0pwrt8:~# free -h > total used free shared buff/cache available > Mem: 62Gi 267Mi 62Gi 1.0Mi 290Mi 61Gi > Swap: 31Gi 0B 31Gi > > Signed-off-by: Neil Sun > --- > mm/vmscan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 562e87cb..81d770a 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -702,7 +702,7 @@ void drop_slab_node(int nid) > return; > > freed = 0; > - memcg = mem_cgroup_iter(NULL, NULL, NULL); > + memcg = mem_cgroup_from_task(current); > do { > freed += shrink_slab(GFP_KERNEL, nid, memcg, 0); > } while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL); > -- > 2.7.4 -- Michal Hocko SUSE Labs