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 9E663C433F5 for ; Mon, 14 Mar 2022 09:51:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F04188D0006; Mon, 14 Mar 2022 05:51:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8C5B8D0001; Mon, 14 Mar 2022 05:51:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2DE98D0006; Mon, 14 Mar 2022 05:51:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id BFCC58D0001 for ; Mon, 14 Mar 2022 05:51:53 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 721E1181951FC for ; Mon, 14 Mar 2022 09:51:53 +0000 (UTC) X-FDA: 79242525306.27.8329140 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf22.hostedemail.com (Postfix) with ESMTP id E8375C001C for ; Mon, 14 Mar 2022 09:51:52 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id C657D1F37E; Mon, 14 Mar 2022 09:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1647251511; 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=5NF6lNWwnFNh+7tS3faEIi4Qi8RnFVdFjDG/PzNtPM8=; b=bhZzDU7v8Wwu25jZoPgqNLGtwJacNFQr0K/jLRcYshdulVjtwHjNRf1zztlxnOmzoc07mJ W7vzaoVfXusWzd9iIBZ0J/Jl+L4G/3VfGPgdIGp+fT6zLiZ+Aj7HzzdBBUU9+rXzDfh536 bWd6IahUctKWu9y+eoqGtn8hVAAhLJU= Received: from suse.cz (unknown [10.163.30.174]) (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 B06FAA3B8A; Mon, 14 Mar 2022 09:51:51 +0000 (UTC) Date: Mon, 14 Mar 2022 10:51:51 +0100 From: Michal Hocko To: Wei Yang Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [Patch v2 1/3] mm/memcg: mz already removed from rb_tree in mem_cgroup_largest_soft_limit_node() Message-ID: References: <20220312071623.19050-1-richard.weiyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220312071623.19050-1-richard.weiyang@gmail.com> X-Stat-Signature: oxtf5x5erjtdxno33u9jzeuetjdu1xhc Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=bhZzDU7v; spf=pass (imf22.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: rspam08 X-Rspamd-Queue-Id: E8375C001C X-HE-Tag: 1647251512-937376 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 Sat 12-03-22 07:16:21, Wei Yang wrote: > When mz is not NULL, mem_cgroup_largest_soft_limit_node() has removed > it from rb_tree. > > Not necessary to call __mem_cgroup_remove_exceeded() again. Yes, the call seems to be unnecessary with the current code. mz can either come from mem_cgroup_largest_soft_limit_node or __mem_cgroup_largest_soft_limit_node both rely on the latter so the mz is always off the tree indeed. > Signed-off-by: Wei Yang After the changelog is completed you can add Acked-by: Michal Hocko In general, though, I am not a super fan of changes like these. The code works as expected, the call for __mem_cgroup_remove_exceeded will not really add much of an overhead and at least we can see that mz is always removed before it is re-added back. In a hot path I would care much more of course but this is effectivelly a dead code as the soft limit itself is mostly a relict of past. Please keep this in mind when you want to make further changes to this area. The review is not free of cost and I am not sure spending time on this area is worthwhile unless there is a real usecase in mind. Thanks! > --- > mm/memcontrol.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index f898320b678a..d70bf5cf04eb 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -3458,7 +3458,6 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, > nr_reclaimed += reclaimed; > *total_scanned += nr_scanned; > spin_lock_irq(&mctz->lock); > - __mem_cgroup_remove_exceeded(mz, mctz); > > /* > * If we failed to reclaim anything from this memory cgroup > -- > 2.33.1 -- Michal Hocko SUSE Labs