From nobody Tue Jun 23 23:42:44 2026 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 4133CC433EF for ; Thu, 24 Feb 2022 12:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234214AbiBXMNA (ORCPT ); Thu, 24 Feb 2022 07:13:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234190AbiBXMM4 (ORCPT ); Thu, 24 Feb 2022 07:12:56 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DF31230E4B for ; Thu, 24 Feb 2022 04:12:25 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K4BZl0GFtzdZdl; Thu, 24 Feb 2022 20:11:11 +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.2308.21; Thu, 24 Feb 2022 20:12:23 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH] mm: use helper macro min and max in unmap_mapping_range_tree Date: Thu, 24 Feb 2022 20:11:34 +0800 Message-ID: <20220224121134.35068-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use helper macro min and max to help simplify the code logic. Minor readability improvement. Signed-off-by: Miaohe Lin --- mm/memory.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 47b667f6b600..7d0f80135a41 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3339,12 +3339,8 @@ static inline void unmap_mapping_range_tree(struct r= b_root_cached *root, vma_interval_tree_foreach(vma, root, first_index, last_index) { vba =3D vma->vm_pgoff; vea =3D vba + vma_pages(vma) - 1; - zba =3D first_index; - if (zba < vba) - zba =3D vba; - zea =3D last_index; - if (zea > vea) - zea =3D vea; + zba =3D max(first_index, vba); + zea =3D min(last_index, vea); =20 unmap_mapping_range_vma(vma, ((zba - vba) << PAGE_SHIFT) + vma->vm_start, --=20 2.23.0