Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3982208pxu; Mon, 12 Oct 2020 06:36:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA+SFsP95Dt4VjslomUnVloRAhGNIQENzL2jndQPizwvBcr6qcOWCvjxgdI5mYzt7N5aSt X-Received: by 2002:a17:906:e0cb:: with SMTP id gl11mr27766621ejb.486.1602509770074; Mon, 12 Oct 2020 06:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602509770; cv=none; d=google.com; s=arc-20160816; b=KIjy5xKcQ0XHVtX6X0hTOxbx2JOTF6HQosAoZiquj4MIx+KMRYXmcvui5aRGdFzUgn eoiaHlC8hzfDA28MWbjTwNGwoOn+umgDkS7grFCzuY1TJ+97pdlM3eftScmKMYjaLs5m r7Cgso5yvpL4/G3ZF5b6hvd96tYoSUxpSJTnMbK86P/Ut4RgJdBUY5gE2Yi4lRy5KOzT pY0QsIHA/sXnLtjM8lJPttN9k3Uk/Y1SAtSGscwvL9KP3hk4kx+YDC2Z/weOollu+Dh7 TdLwwgtDZM194bbXJZYnu9IIjE5i+FE4szI05q/64WLuNJ58EP1ccoAPD36qJ31Gi/xo N2qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=IkJyVWMJqUxy+2lm9HZhl5nR51JRSgjWAi5KvffDUFI=; b=gcLILy5Z02SlNIWKKDv2oWRTHBIdLS34liLefaJONQsUp/kF6yF2961VQ9At5xfy88 kDMFAj5HUjZjbD5JZbsLhYnG9xOuQ6OF3Knr6z97yn9/0AkwniDOLqASfXjL7t5cbVmH dQJkiFX9IS8bxVP1C6xQWcjC8opzjsj77m6uVmGATCDjjKRxZHw2fOsczs6CCSN8roz8 tI2AioEHRQD1Xi1guooP9q36kRvkMsOeevovHU3u12ODC1yGVvFFFR8abrJpUf0bCY5K 06Oby6Z6jU6TrP44ecmqUiGbHGNBa1lkyrvZL5gYfg0TH4ss9lD2Kp8Zq8QUDtteGzCV YH1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lj15si11516565ejb.612.2020.10.12.06.35.47; Mon, 12 Oct 2020 06:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388828AbgJLNQ2 (ORCPT + 99 others); Mon, 12 Oct 2020 09:16:28 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:15277 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388013AbgJLNQ1 (ORCPT ); Mon, 12 Oct 2020 09:16:27 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 7413DE0DD3DA402645AC; Mon, 12 Oct 2020 21:16:24 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Mon, 12 Oct 2020 21:16:18 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2] mm: memcontrol: eliminate redundant check in __mem_cgroup_insert_exceeded() Date: Mon, 12 Oct 2020 09:16:07 -0400 Message-ID: <20201012131607.10656-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Also drop the comment which doesn't really explain much. Acked-by: Michal Hocko Signed-off-by: Miaohe Lin --- mm/memcontrol.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2636f8bad908..b080a9434b9e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -623,14 +623,9 @@ static void __mem_cgroup_insert_exceeded(struct mem_cgroup_per_node *mz, if (mz->usage_in_excess < mz_node->usage_in_excess) { p = &(*p)->rb_left; rightmost = false; - } - - /* - * 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; + } } if (rightmost) -- 2.19.1