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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B57FC433EF for ; Fri, 8 Apr 2022 14:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236738AbiDHONQ (ORCPT ); Fri, 8 Apr 2022 10:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236718AbiDHONO (ORCPT ); Fri, 8 Apr 2022 10:13:14 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659C334B914; Fri, 8 Apr 2022 07:11:10 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 19956210EE; Fri, 8 Apr 2022 14:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1649427069; 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=gNPsT3NKhlXnfi2F2vg55Kv/xhOi4VGOL+j6MMtTFeQ=; b=cfXqbCqyXyBa9orgccUoy4424ix9hLjiTcErReYj3EGVeVskbNNPsd6jezIUyblN1T6VI/ /PKqJNKcV+Av8NjuXjYKDNOPjnnWzy0/mCCms8pAaSht4wSV42B5hoL2fPkU54vQzpRJeZ ikVj76De+BwGGpCsVa7bGeTVBr4jiS0= 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 4364AA3B83; Fri, 8 Apr 2022 14:11:08 +0000 (UTC) Date: Fri, 8 Apr 2022 16:11:05 +0200 From: Michal Hocko To: Dan Schatzberg Cc: Yosry Ahmed , Johannes Weiner , Shakeel Butt , Andrew Morton , Roman Gushchin , David Rientjes , 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@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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: Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Fri 08-04-22 09:43:03, Dan Schatzberg wrote: > On Fri, Apr 08, 2022 at 04:57:40AM +0000, Yosry Ahmed wrote: > > +static ssize_t memory_reclaim(struct kernfs_open_file *of, char *buf, > > + size_t nbytes, loff_t off) > > +{ > > + struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of)); > > + unsigned int nr_retries = MAX_RECLAIM_RETRIES; > > + unsigned long nr_to_reclaim, nr_reclaimed = 0; > > + int err; > > + > > + buf = strstrip(buf); > > + err = page_counter_memparse(buf, "", &nr_to_reclaim); > > Is there a reason not to support "max"? Empty string seems odd to me > here. I have to say I have missed the special meaning of the empty string here and I agree this would indeed really weird. Does cgroup core even call here? cgroup_file_write seems to drop !nbytes input. 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? -- Michal Hocko SUSE Labs