From patchwork Tue Mar 22 21:42:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789119 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 D3ED4C433FE for ; Tue, 22 Mar 2022 21:42:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F01326B00C1; Tue, 22 Mar 2022 17:42:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E60AB6B00C2; Tue, 22 Mar 2022 17:42:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C17E36B00C3; Tue, 22 Mar 2022 17:42:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0115.hostedemail.com [216.40.44.115]) by kanga.kvack.org (Postfix) with ESMTP id AEA676B00C1 for ; Tue, 22 Mar 2022 17:42:35 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7711B182895A5 for ; Tue, 22 Mar 2022 21:42:35 +0000 (UTC) X-FDA: 79273346670.31.E36CA9D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 073A22001F for ; Tue, 22 Mar 2022 21:42:34 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F5B560A14; Tue, 22 Mar 2022 21:42:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE339C340EE; Tue, 22 Mar 2022 21:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985353; bh=QkjuG4RlAp0lVQvcDkJiAAem/hBEFCOY6/rUVHq5FQw=; h=Date:To:From:In-Reply-To:Subject:From; b=NmO3q/0inf88gph868xUVDbnQitySWqaAYp4AWjfrKb3r6uxFIreXSDTPKMMNC/pQ tH9+8eFcEEt1EI2TmHRIqss50ssLUJ3zU/pj6nZZ8MD9a0Q81P3NbWp99fbO9iI5sZ KoFZk4AZzSFt5YxP8hYR007ZEuNJh60qsD3DrXCA= Date: Tue, 22 Mar 2022 14:42:33 -0700 To: linmiaohe@huawei.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 079/227] mm/memory.c: use helper macro min and max in unmap_mapping_range_tree() Message-Id: <20220322214233.BE339C340EE@smtp.kernel.org> Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="NmO3q/0i"; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: rrzxmbg4yg4okqhy9xfpanoy6d9fn7eb X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 073A22001F X-HE-Tag: 1647985354-537045 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: From: Miaohe Lin Subject: mm/memory.c: use helper macro min and max in unmap_mapping_range_tree() Use helper macro min and max to help simplify the code logic. Minor readability improvement. Link: https://lkml.kernel.org/r/20220224121134.35068-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Signed-off-by: Andrew Morton --- mm/memory.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/mm/memory.c~mm-use-helper-macro-min-and-max-in-unmap_mapping_range_tree +++ a/mm/memory.c @@ -3350,12 +3350,8 @@ static inline void unmap_mapping_range_t vma_interval_tree_foreach(vma, root, first_index, last_index) { vba = vma->vm_pgoff; vea = vba + vma_pages(vma) - 1; - zba = first_index; - if (zba < vba) - zba = vba; - zea = last_index; - if (zea > vea) - zea = vea; + zba = max(first_index, vba); + zea = min(last_index, vea); unmap_mapping_range_vma(vma, ((zba - vba) << PAGE_SHIFT) + vma->vm_start,