From patchwork Wed Jan 29 00:26:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11355379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DE5A159A for ; Wed, 29 Jan 2020 00:27:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 616E922522 for ; Wed, 29 Jan 2020 00:27:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 616E922522 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9D8876B0003; Tue, 28 Jan 2020 19:27:08 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 989246B0005; Tue, 28 Jan 2020 19:27:08 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89E756B0006; Tue, 28 Jan 2020 19:27:08 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 717976B0003 for ; Tue, 28 Jan 2020 19:27:08 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 38CB8180AD801 for ; Wed, 29 Jan 2020 00:27:08 +0000 (UTC) X-FDA: 76428782136.20.error32_5b543e7bee92b X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,richardw.yang@linux.intel.com,:akpm@linux-foundation.org:aneesh.kumar@linux.ibm.com:kirill@shutemov.name:dan.j.williams@intel.com:yang.shi@linux.alibaba.com:thellstrom@vmware.com:richardw.yang@linux.intel.com:linux-kernel@vger.kernel.org::digetx@gmail.com,RULES_HIT:30012:30054:30070,0,RBL:192.55.52.120:@linux.intel.com:.lbl8.mailshell.net-62.18.0.100 64.95.201.95,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: error32_5b543e7bee92b X-Filterd-Recvd-Size: 2135 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Jan 2020 00:27:07 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2020 16:27:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,375,1574150400"; d="scan'208";a="223688949" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga008.fm.intel.com with ESMTP; 28 Jan 2020 16:27:04 -0800 From: Wei Yang To: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, kirill@shutemov.name, dan.j.williams@intel.com, yang.shi@linux.alibaba.com, thellstrom@vmware.com, richardw.yang@linux.intel.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, digetx@gmail.com Subject: [Patch v2 0/4] mm/mremap: cleanup move_page_tables() a little Date: Wed, 29 Jan 2020 08:26:38 +0800 Message-Id: <20200129002642.13508-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 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 separately. 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. v2: * remove 3rd patch which doesn't work on ARM platform. Thanks report from Dmitry Osipenko Wei Yang (4): mm/mremap: format the check in move_normal_pmd() same as move_huge_pmd() 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 include/linux/huge_mm.h | 2 +- mm/huge_memory.c | 8 +------- mm/mremap.c | 17 ++++++----------- 3 files changed, 8 insertions(+), 19 deletions(-) Tested-by: Dmitry Osipenko