From patchwork Wed Jul 8 01:24:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11650541 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 92DB0739 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 6932920786 for ; Wed, 8 Jul 2020 01:25:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6932920786 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 546138D0003; Tue, 7 Jul 2020 21:25:48 -0400 (EDT) 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 45BF38D0009; Tue, 7 Jul 2020 21:25:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,2a215cf926e4fad8,d41d8cd98f00b204,richard.weiyang@linux.alibaba.com,,RULES_HIT:41:69:355:379:541:968:988:989:1260:1261:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3872:4250:4605:5007:6119:6261:6737:7807:7903:10004:11026:11658:11914:12048:12297:12895:13069:13161:13229:13311:13357:13894:14096:14384:14721:21080:21451:21627:21740:30012:30054:30065:30070,0,RBL:115.124.30.43:@linux.alibaba.com:.lbl8.mailshell.net-64.201.201.201 62.20.2.100;04y8co1pjnog7whd4r6phwy6kidmeoc64wzhkpqe5yubgcj54sgnyahbjcu6ym4.drw48wxboqw4cqpw1nhfxtw5x44qa1sd7m8y3hdsxpz17qehzyw3x8yzzq63ptz.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:22,LUA_SUMMARY:none 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 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. 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 and 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(-)