From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Hocko Subject: Re: [PATCH v5 1/4] memcg: introduce per-memcg reclaim interface Date: Tue, 26 Apr 2022 10:22:42 +0200 Message-ID: References: <20220425190040.2475377-1-yosryahmed@google.com> <20220425190040.2475377-2-yosryahmed@google.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1650961366; 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=NKbpFjMDPqd7TQ514NLGknGrSkR1xvTuZ+twvGBw1Ds=; b=Ku8RBnA0Rf9zQsz4S8BTrgHF20lahZ8buxMT5bsutog3s+qQEzlQpjXalln29/WK/9rWTe y/9DNr88hxHzQwcPkYA9KVTaL8FZ7DTVb/ZbTuzWAufvvhtv6te6DXO8ZUj85HjsIehW/n qbSDE3xjlsTQgKOtmALRZ+WjV1K1F3E= Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Yosry Ahmed Cc: David Rientjes , Johannes Weiner , Shakeel Butt , Andrew Morton , Roman Gushchin , Tejun Heo , 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux Kernel Mailing List , Linux-MM On Mon 25-04-22 12:31:51, Yosry Ahmed wrote: > On Mon, Apr 25, 2022 at 12:15 PM David Rientjes wrote: [...] > > "can over or under reclaim from the target cgroup" begs the question of > > how much more memory the kernel can decide to reclaim :) I think it's > > assumed that it's minimal and that matches the current implementation that > > rounds up to SWAP_CLUSTER_MAX, though, so looks good. > > > > Thanks Yosry! > > I think it could be more complex than this. Some functions that get > called during reclaim only use the nr_to_reclaim parameter to check if > they need one more iteration, but not to limit the actual reclaimed > pages per say. For example, nr_to_reclaim is not even passed to > shrink_slab() or mem_cgroup_soft_limit_reclaim(), so they have no way > to know that they should stop if nr_to_reclaim was already satisfied. > I think the general assumption is that each of these calls normally > does not reclaim a huge number of pages, so like you said, the kernel > should not over-reclaim too much. However, I don't think there are > guarantees about this. There are no guarantees indeed and it si definitely good to be explicit about that so that userspace tools expect that and consider that in the imeplementation. Sure we do not want to go overboard and huge excess should be considered a bug. I am not sure we do agree on the notion of "huge" so let's see. -- Michal Hocko SUSE Labs