From patchwork Fri Oct 9 13:51:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 11825851 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B1E81752 for ; Fri, 9 Oct 2020 13:51:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D3392222C3 for ; Fri, 9 Oct 2020 13:51:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3392222C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1323B6B006E; Fri, 9 Oct 2020 09:51:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0E4B26B0071; Fri, 9 Oct 2020 09:51:27 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3B7A6B0072; Fri, 9 Oct 2020 09:51:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id C83276B006E for ; Fri, 9 Oct 2020 09:51:26 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EFC5433C4 for ; Fri, 9 Oct 2020 13:51:25 +0000 (UTC) X-FDA: 77352524130.14.hall72_130aa46271e1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id C9C3E1822989D for ; Fri, 9 Oct 2020 13:51:25 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,linmiaohe@huawei.com,,RULES_HIT:30005:30054:30070,0,RBL:45.249.212.191:@huawei.com:.lbl8.mailshell.net-64.95.201.95 62.18.2.100;04y8hn55g61gd53oy5gppdp951g3uyptekwuhjph3i3mdtgp8mkyjwgwj9ir59e.171mxiaasc8ywg6dd9j8qwsrnn8gbi7aeibscb3syessknkj9fn6y15584frz98.1-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: hall72_130aa46271e1 X-Filterd-Recvd-Size: 1959 Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Fri, 9 Oct 2020 13:51:24 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4CAA0C8C8E38F4713939; Fri, 9 Oct 2020 21:51:20 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Fri, 9 Oct 2020 21:51:13 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH] mm: memcontrol: eliminate redundant check in __mem_cgroup_insert_exceeded() Date: Fri, 9 Oct 2020 09:51:04 -0400 Message-ID: <20201009135104.39048-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected 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: The mz->usage_in_excess >= mz_node->usage_in_excess check is exactly the else case of mz->usage_in_excess < mz_node->usage_in_excess. So we could replace else if (mz->usage_in_excess >= mz_node->usage_in_excess) with else equally. Signed-off-by: Miaohe Lin Acked-by: Michal Hocko --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2636f8bad908..f607afd0fcbf 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -629,7 +629,7 @@ static void __mem_cgroup_insert_exceeded(struct mem_cgroup_per_node *mz, * We can't avoid mem cgroups that are over their soft * limit by the same amount */ - else if (mz->usage_in_excess >= mz_node->usage_in_excess) + else p = &(*p)->rb_right; }