Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp589266ybt; Fri, 26 Jun 2020 06:55:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyku7HHkAduYP6YPELEmm5CrIft/zmrdA7OSLWZvYMUaQyc7iszzYbQ2zRBSUiYhIXj7zgh X-Received: by 2002:a17:906:da19:: with SMTP id fi25mr2582081ejb.369.1593179703456; Fri, 26 Jun 2020 06:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593179703; cv=none; d=google.com; s=arc-20160816; b=NJbi0gH5K+bGrIyKMDjM9XtuobPRy3qn4UlKfRxt9xs/SaePdg9St6OeKVhp4UNGUq BohXCfvOhazbNYXsKjqKrh/JBOYBqzVRQJf1Y6XQgr3ctNWXrYt7wgMAItsXfxZ02iJI rmbBNp41uq/k/ugh9dUuPsCq+QqaSKwf5x7/F9gBQBluELxZMpNzcph8/IkWxVjHehHu yB35dIJrJtKfBlHK3zC9voCbVxyXb34H3YrpinEPmri7ZJWr5xcJ3b0QfgloDP7QqHeI XmQ7RpfoT0TYPRY0T/baDDx6iSHtROBe3Q8ubGKhraf3i80AGVbdEBfaOyX4uTQEfOTu wlng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qvxA2VbQKXtR5IVjo7eEYZNMBY/95/bMzxhLM6lYVp0=; b=stC8WZFOx0Kp+AMMSrQAG/tnS4GA52Civkne6RXoNs7RBLw3QOq956ob8LWRET/UA3 ONaOhCRkjvlDPjREZEraj/+Vhwd8f8CXRy4D3KIN+he6BwxrUYFCZ91ClXlU/3UB+uT5 n7Ie3ftwppn98hfJw1KgqyJURDf6o1qrgEG+Td/wgc/mQ748r9Z9j7acevf7F73cBV/M ykATgpPYWCK0ZqhtTa3/kr1OAT1t0rTB/XlDmMMLKYZlTsTlAYh+BwePF7cSWJLAyJAF JJs2Ca0gxAqa45sWR+J0FR19GcpOJ+FbNN/smN7xEAy627r+yEHGjs0hdJxMXV+/BGJu sqCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh8si7413397ejb.245.2020.06.26.06.54.40; Fri, 26 Jun 2020 06:55:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728953AbgFZNwg (ORCPT + 99 others); Fri, 26 Jun 2020 09:52:36 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:44965 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728936AbgFZNwf (ORCPT ); Fri, 26 Jun 2020 09:52:35 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R981e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01422;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0U0lVmOA_1593179549; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U0lVmOA_1593179549) by smtp.aliyun-inc.com(127.0.0.1); Fri, 26 Jun 2020 21:52:29 +0800 From: Wei Yang To: akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, yang.shi@linux.alibaba.com, vbabka@suse.cz, willy@infradead.org, thomas_os@shipmail.org, thellstrom@vmware.com, anshuman.khandual@arm.com, sean.j.christopherson@intel.com, aneesh.kumar@linux.ibm.com, peterx@redhat.com, walken@google.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, digetx@gmail.com, Wei Yang Subject: [RESEND Patch v2 0/4] mm/mremap: cleanup move_page_tables() a little Date: Fri, 26 Jun 2020 21:52:12 +0800 Message-Id: <20200626135216.24314-1-richard.weiyang@linux.alibaba.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 and test 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(-) -- 2.20.1 (Apple Git-117)