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 210B4C433F5 for ; Wed, 20 Apr 2022 12:47:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 702176B0072; Wed, 20 Apr 2022 08:47:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68B686B0073; Wed, 20 Apr 2022 08:47:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5053A6B0074; Wed, 20 Apr 2022 08:47:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 416C56B0072 for ; Wed, 20 Apr 2022 08:47:14 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 0A8B38289D for ; Wed, 20 Apr 2022 12:47:14 +0000 (UTC) X-FDA: 79377232788.11.63CF854 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf22.hostedemail.com (Postfix) with ESMTP id 127DDC0017 for ; Wed, 20 Apr 2022 12:47:12 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0A1F1210F1; Wed, 20 Apr 2022 12:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1650458832; 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=fE2JVFjVSECX2xSom7dha9uadrw2m4rx6MxVgcht3TU=; b=ls08cpYNS6BsFKbzep+CNbq8sfVdl2ellBWBujxnccydNYGlZusiruxwRBWAGNdG+LbEjN jBIdNmHiFta1RBcAXwfZU0dmIdTZsOgoaKPo4njd2eiadAdPKoabYOFObP16BYeeo/IWJ6 6qVYRksrngynbRG+maQ3Tkc4EqFNkn0= 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 261B62C142; Wed, 20 Apr 2022 12:47:11 +0000 (UTC) Date: Wed, 20 Apr 2022 14:47:10 +0200 From: Michal Hocko To: Yosry Ahmed Cc: Johannes Weiner , Shakeel Butt , Andrew Morton , Roman Gushchin , David Rientjes , Tejun Heo , Dan Schatzberg , Zefan Li , Jonathan Corbet , Shuah Khan , Yu Zhao , Dave Hansen , Wei Xu , Greg Thelen , Chen Wandun , Vaibhav Jain , Michal =?iso-8859-1?Q?Koutn=FD?= , Tim Chen , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Linux Kernel Mailing List , Linux-MM , linux-kselftest@vger.kernel.org Subject: Re: [PATCH v3 1/4] memcg: introduce per-memcg reclaim interface Message-ID: References: <20220408045743.1432968-1-yosryahmed@google.com> <20220408045743.1432968-2-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 127DDC0017 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=ls08cpYN; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf22.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: 9u4dsit66moiazpd56uwtdu8qs1bqnni X-HE-Tag: 1650458832-920139 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 14-04-22 10:25:29, Yosry Ahmed wrote: > On Fri, Apr 8, 2022 at 1:08 PM Yosry Ahmed wrote: > > > > On Fri, Apr 8, 2022 at 7:55 AM Dan Schatzberg wrote: > > > > > > On Fri, Apr 08, 2022 at 04:11:05PM +0200, Michal Hocko wrote: > > > > Regarding "max" as a possible input. I am not really sure to be honest. > > > > I can imagine that it could be legit to simply reclaim all the charges > > > > (e.g. before removing the memcg) which should be achieveable by > > > > reclaiming the reported consumption. Or what exactly should be the > > > > semantic? > > > > > > Yeah, it just allows you to avoid reading memory.current to just > > > reclaim everything if you can specify "max" - you're still protected > > > by nretries to eventually bail out. Mostly, though I just feel like > > > supporting "max" makes memory.reclaim semetric with a lot of the > > > cgroup memory control files which tend to support "max". > > > > One possible approach here is to have force_empty behavior when we > > write "max" to memory.reclaim. From Google's perspective we don't have > > a preference, but it seems to me like logical behavior. We can do this > > either by directly calling mem_cgroup_force_empty() or just draining > > stock and lrus in memory_reclaim(). > > > > This actually brings up another interesting point. Do you think we > > should drain lrus if try_to_free_mem_cgroup_pages() fails to reclaim > > the request amount? We can do this after the first call or before the > > last one. It could introduce more evictable pages for > > try_to_free_mem_cgroup_pages() to free. > > Hey Michal, any thoughts on this? I am looking for feedback on this > before I send out v4. As I've already said I do not have strong preferences for the "max" value to be accepted by the interface. Maybe you can add a support for max in a separate patch so the discussion would not delay the rest of the work. For the LRU draining I do not see any problem for that to be added. The overhead of the operation would increase, especially on larger machines, which could be a concern. So the real question is whether not doing so is a big problem. Our force_empty implementation optimistically drains pcp caches but please note that this is not really guranteeing anything as charges can happen at any time. -- Michal Hocko SUSE Labs