From patchwork Fri Jul 10 09:28:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11656111 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 E4CAF92A for ; Fri, 10 Jul 2020 09:29:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B0F832082E for ; Fri, 10 Jul 2020 09:29:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0F832082E 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 C42B86B0005; Fri, 10 Jul 2020 05:29:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BCAC88D0003; Fri, 10 Jul 2020 05:29:02 -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 ADFEC6B0007; Fri, 10 Jul 2020 05:29:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 99AD46B0005 for ; Fri, 10 Jul 2020 05:29:02 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4A193181AEF0B for ; Fri, 10 Jul 2020 09:29:02 +0000 (UTC) X-FDA: 77021642124.27.snail91_5506b0226ecd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 1961161EE7 for ; Fri, 10 Jul 2020 09:29:02 +0000 (UTC) X-Spam-Summary: 1,0,0,26062b3f4f252526,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:2198:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865: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.132:@linux.alibaba.com:.lbl8.mailshell.net-64.201.201.201 62.20.2.100;04yffnf5gekuj6ybmyc3znf8zkifmopxqftwnb74jtx464615mgnyahbjcuhjmf.modf4xxm63zkge53da19k6zr66j1ib7zuaqm5jwsu1qoj5dau485hc1sz4eq7od.y-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:24,LUA_SUMMARY:none X-HE-Tag: snail91_5506b0226ecd X-Filterd-Recvd-Size: 2506 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 10 Jul 2020 09:29:00 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;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_---0U2HJelQ_1594373332; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U2HJelQ_1594373332) by smtp.aliyun-inc.com(127.0.0.1); Fri, 10 Jul 2020 17:28:52 +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 v5 0/3] mm/mremap: cleanup move_page_tables() a little Date: Fri, 10 Jul 2020 17:28:32 +0800 Message-Id: <20200710092835.56368-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: 1961161EE7 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. v5: * remove the last patch which breaks on ARM 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 and test from Dmitry Osipenko Wei Yang (3): 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(-)