From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1908EC433E1 for ; Wed, 8 Jul 2020 01:25:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D843420786 for ; Wed, 8 Jul 2020 01:25:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D843420786 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5BCEB8D0009; Tue, 7 Jul 2020 21:25:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 546138D0003; Tue, 7 Jul 2020 21:25:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45BF38D0009; Tue, 7 Jul 2020 21:25:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id 2D8BF8D0003 for ; Tue, 7 Jul 2020 21:25:48 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DD69F2C6D for ; Wed, 8 Jul 2020 01:25:47 +0000 (UTC) X-FDA: 77013166734.18.chalk11_1e0d29226eb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id B6DC4100EDBEA for ; Wed, 8 Jul 2020 01:25:47 +0000 (UTC) X-HE-Tag: chalk11_1e0d29226eb9 X-Filterd-Recvd-Size: 2466 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Wed, 8 Jul 2020 01:25:46 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R331e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0U243BE._1594171543; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U243BE._1594171543) by smtp.aliyun-inc.com(127.0.0.1); Wed, 08 Jul 2020 09:25:43 +0800 From: Wei Yang To: akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, vbabka@suse.cz, yang.shi@linux.alibaba.com, thomas_os@shipmail.org, anshuman.khandual@arm.com, sean.j.christopherson@intel.com, richard.weiyang@linux.alibaba.com, peterx@redhat.com, aneesh.kumar@linux.ibm.com, willy@infradead.org, thellstrom@vmware.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, digetx@gmail.com Subject: [Patch v3 0/4] mm/mremap: cleanup move_page_tables() a little Date: Wed, 8 Jul 2020 09:24:49 +0800 Message-Id: <20200708012453.36588-1-richard.weiyang@linux.alibaba.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 X-Rspamd-Queue-Id: B6DC4100EDBEA X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 Content-Transfer-Encoding: quoted-printable 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: move_page_tables() tries to move page table by PMD or PTE. The root reason is if it tries to move PMD, both old and new range should= be PMD aligned. But current code calculate old range and new range separatel= y. This leads to some redundant check and calculation. This cleanup tries to consolidate the range check in one place to reduce = some extra range handling. v3: * merge patch 1 with 2 as suggested by Kirill * add patch 4 to simplify the logic to calculate next and extent v2: * remove 3rd patch which doesn't work on ARM platform. Thanks report an= d test from Dmitry Osipenko Wei Yang (4): mm/mremap: it is sure to have enough space when extent meets requirement mm/mremap: calculate extent in one place mm/mremap: start addresses are properly aligned mm/mremap: use pmd_addr_end to simplify the calculate of extent include/linux/huge_mm.h | 2 +- mm/huge_memory.c | 8 +------- mm/mremap.c | 27 ++++++++++----------------- 3 files changed, 12 insertions(+), 25 deletions(-) --=20 2.20.1 (Apple Git-117)