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 3C5AAC433E0 for ; Wed, 8 Jul 2020 09:50:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 086A420739 for ; Wed, 8 Jul 2020 09:50:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 086A420739 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 D0A398D000D; Wed, 8 Jul 2020 05:50:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C72668D0040; Wed, 8 Jul 2020 05:50:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF2408D0041; Wed, 8 Jul 2020 05:50:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id 9B5058D0040 for ; Wed, 8 Jul 2020 05:50:51 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 583D8181AEF0B for ; Wed, 8 Jul 2020 09:50:51 +0000 (UTC) X-FDA: 77014439502.14.mint70_0f0164526ebc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 30D5E18229835 for ; Wed, 8 Jul 2020 09:50:51 +0000 (UTC) X-HE-Tag: mint70_0f0164526ebc X-Filterd-Recvd-Size: 2527 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Wed, 8 Jul 2020 09:50:49 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R711e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0U26GSJh_1594201842; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U26GSJh_1594201842) by smtp.aliyun-inc.com(127.0.0.1); Wed, 08 Jul 2020 17:50: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 v4 0/4] mm/mremap: cleanup move_page_tables() a little Date: Wed, 8 Jul 2020 17:50:24 +0800 Message-Id: <20200708095028.41706-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: 30D5E18229835 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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. v4: * remove a redundant parentheses pointed by Kirill 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)