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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA51CC433EF for ; Thu, 31 Mar 2022 11:35:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6029D6B0072; Thu, 31 Mar 2022 07:35:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B2456B0073; Thu, 31 Mar 2022 07:35:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 454046B0074; Thu, 31 Mar 2022 07:35:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 331A86B0072 for ; Thu, 31 Mar 2022 07:35:21 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CDFBA182EFDCF for ; Thu, 31 Mar 2022 11:35:20 +0000 (UTC) X-FDA: 79304475600.26.7B9E1F4 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf19.hostedemail.com (Postfix) with ESMTP id 2E6511A000C for ; Thu, 31 Mar 2022 11:35:20 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B479E1F37D; Thu, 31 Mar 2022 11:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1648726518; 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=0iGRqDVWtIbClXX9jVOMp8RjR3wfp+eidE5p7MXuygs=; b=eSREMlixUKn6FkfFx7u1sXdAW8YfxbXQ50cR770VPYQGAn1vhhuQOVHNRs+0p7rOT0z1z2 eAxqWj82Yt9i2/1Wl6gtsjymIYuNLpYZFT5Qv7KDDzAcVu+uwKE5w0U4rTjh0KYXb0G3gF vcqGFJUs6orzHF0kMWDD30ruR+xl34s= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4B8B2A3B87; Thu, 31 Mar 2022 11:35:18 +0000 (UTC) Date: Thu, 31 Mar 2022 13:35:14 +0200 From: Michal Hocko To: Zhaoyang Huang Cc: "zhaoyang.huang" , Andrew Morton , Johannes Weiner , Suren Baghdasaryan , Vladimir Davydov , "open list:MEMORY MANAGEMENT" , LKML , cgroups@vger.kernel.org, Ke Wang Subject: Re: [RFC PATCH] cgroup: introduce dynamic protection for memcg Message-ID: References: <1648713656-24254-1-git-send-email-zhaoyang.huang@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=eSREMlix; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2E6511A000C X-Stat-Signature: bexzzee6jbth7ugqdxo8yrzm96s66zh9 X-HE-Tag: 1648726520-777856 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 Thu 31-03-22 19:18:58, Zhaoyang Huang wrote: > On Thu, Mar 31, 2022 at 5:01 PM Michal Hocko wrote: > > > > On Thu 31-03-22 16:00:56, zhaoyang.huang wrote: > > > From: Zhaoyang Huang > > > > > > For some kind of memcg, the usage is varies greatly from scenarios. Such as > > > multimedia app could have the usage range from 50MB to 500MB, which generated > > > by loading an special algorithm into its virtual address space and make it hard > > > to protect the expanded usage without userspace's interaction. > > > > Do I get it correctly that the concern you have is that you do not know > > how much memory your workload will need because that depends on some > > parameters? > right. such as a camera APP will expand the usage from 50MB to 500MB > because of launching a special function(face beauty etc need special > algorithm) > > > > > Furthermore, fixed > > > memory.low is a little bit against its role of soft protection as it will response > > > any system's memory pressure in same way. > > > > Could you be more specific about this as well? > As the camera case above, if we set memory.low as 200MB to keep the > APP run smoothly, the system will experience high memory pressure when > another high load APP launched simultaneously. I would like to have > camera be reclaimed under this scenario. OK, so you effectivelly want to keep the memory protection when there is a "normal" memory pressure but want to relax the protection on other high memory utilization situations? How do you exactly tell a difference between a steady memory pressure (say stream IO on the page cache) from "high load APP launched"? Should you reduce the protection on the stram IO situation as well? [...] > > One very important thing that I am missing here is the overall objective of this > > tuning. From the above it seems that you want to (ab)use memory->low to > > protect some portion of the charged memory and that the protection > > shrinks over time depending on the the global PSI metrict and time. > > But why this is a good thing? > 'Good' means it meets my original goal of keeping the usage during a > period of time and responding to the system's memory pressure. For an > android like system, memory is almost forever being in a tight status > no matter how many RAM it has. What we need from memcg is more than > control and grouping, we need it to be more responsive to the system's > load and could sacrifice its usage under certain criteria. Why existing tools/APIs are insufficient for that? You can watch for both global and memcg memory pressure including PSI metrics and update limits dynamically. Why is it necessary to put such a logic into the kernel? -- Michal Hocko SUSE Labs