Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp464850imn; Thu, 28 Jul 2022 06:16:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vc3XZgeH/w2QccIE4jJ7vgzh67RP3dAs5uswyys5qPsMbg0i6ZT90GSKnrZekucUYRKptc X-Received: by 2002:a17:902:9b96:b0:16c:83f0:33f8 with SMTP id y22-20020a1709029b9600b0016c83f033f8mr26362941plp.4.1659014162900; Thu, 28 Jul 2022 06:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659014162; cv=none; d=google.com; s=arc-20160816; b=mD7syiNsHkAjQ7fHwVBnwBeVuA06UlYvZORLOoFT/vShLl2e6ecN5ZYW3E5ga+9QTX pJ/7hhMqCZXOWdybgEv33+fR3MFk870t7imdO0c1QhbEz6zmNxZ5qEQfiiOhXPQ8uaAV RVuwi8JATrHstM53lRVepegT+tE1826z/672l8FqhjfsNttWz2jrnE0iu1eDflaDZOWW ireQX9nZH2u+Izu+GxwW2hI6xwPXk0+CFUm6pm6Djjv3jUePD4RXn5pavsXhh5wRfR4i QL+1tMIV7+3CN7N/Wq2Xta8PJ69kjkA9Yd3uGYzaJrwJc/JNVo/fJvyeB+gurVt762nT vdYA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bk4cKHKgikA2vyM2dn1DknUbHeBKPZsSfduFmFPoKs0=; b=EI5Y2xCxeLDCfRu1EPyurx2IEtTJ8GVkApTh6431GGSvUZ+rO9fx9fkI9fA3Jz0f6j iMw7WmLftI+PJyR9HiSa/Mu/7kWRGdqE4c+jKZO2VtXp5oCNEolRcou7L2ZL4zq2Hyen GC2KXzgwbswJnkwja+Rvog+D4xYjumNAPpF6UZJ4ea3QLDYwvOxRd037J9fWjSiNGhQ8 wImuyw2imPJqy5yhBOVUPLgrcwP7zCC/LQx6xX6b+OaRIXCr4Yxi9zvdE4g72AnXPnq7 S91ccU1uThYdSJtkEwUIdeGkWlmh2vaQgy1DdyakrbMsf4uNfQr2Ydn5dts+jmmkXq7l 068Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s80-20020a632c53000000b0040cf043ed35si1059239pgs.814.2022.07.28.06.15.47; Thu, 28 Jul 2022 06:16:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236545AbiG1MUK (ORCPT + 99 others); Thu, 28 Jul 2022 08:20:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230216AbiG1MUI (ORCPT ); Thu, 28 Jul 2022 08:20:08 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C084E2F9 for ; Thu, 28 Jul 2022 05:20:06 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LtqQy3lyWzlVsF; Thu, 28 Jul 2022 20:17:30 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 28 Jul 2022 20:20:04 +0800 From: Miaohe Lin To: CC: , , , , Subject: [PATCH 1/6] hugetlb_cgroup: remove unneeded nr_pages > 0 check Date: Thu, 28 Jul 2022 20:19:44 +0800 Message-ID: <20220728121949.20985-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220728121949.20985-1-linmiaohe@huawei.com> References: <20220728121949.20985-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When code reaches here, nr_pages must be > 0. Remove unneeded nr_pages > 0 check to simplify the code. Signed-off-by: Miaohe Lin --- mm/hugetlb_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index c86691c431fd..d16eb00c947d 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -442,7 +442,7 @@ void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, if (hugetlb_cgroup_disabled() || !resv || !rg || !nr_pages) return; - if (rg->reservation_counter && resv->pages_per_hpage && nr_pages > 0 && + if (rg->reservation_counter && resv->pages_per_hpage && !resv->reservation_counter) { page_counter_uncharge(rg->reservation_counter, nr_pages * resv->pages_per_hpage); -- 2.23.0