Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp588415ybt; Fri, 26 Jun 2020 06:53:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeQrQwgNgU+RpAArc4z5FcXJBBvQUOq8BmitfUmQWmCw3RSnR2X+bRebZkKwBsak+XCLvU X-Received: by 2002:a17:906:eb4b:: with SMTP id mc11mr2585359ejb.5.1593179623863; Fri, 26 Jun 2020 06:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593179623; cv=none; d=google.com; s=arc-20160816; b=jcLtHYlCwtr+1s2wgOw+htDaI4F48t5y4U+jTj3cWKapVx5M8520Xgy71ioslFrem7 XovtJC0XFSo2uiNFyHM0CCE++pvGxbRKctWAaCtfTCmQHjIsB9Q+xBlUpi4VNRX5DEGh rgQNI7aaXFNju0HgPHpl8C92K78MSPsPR8FzcB8RimxrQHVmDeLqDrOjo+g/XPowdL99 Q+6Ln+rygitrm5YquxWCz3ihsiOUpSIq1ftYMdwgUXoqZKzwkl2Q8DM53hbB4T0ithAD zhMA0LxYfvbhLUiYEqcsGuYXSrz87VXKu7ZBneFnOCEqM9kNNggiDjDhNrwRXjxQ8vv4 9xAw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YKfbAtkD1A/iH2Um4FIgNImc6gMm0LW98POMWKxvqxs=; b=X2f+rWAJkIhy6ohLDS2xcbh2NIiJzz45jHkP8eXfxY8X4p/TkvyhJLUrErx6wjsEp1 E5EqB1PDeuq4Npvxpcwn4vpRuAXwTViQdPMMMYxtKnBwYCHSmIKcR17xYgA5l4BkLJ+W LHpuKOJp1qnIoX4bTcMWzXgH5MAuGYVlkV/NdiAIcEl70hzXn0pnEYaQOvEBVoqVpxQv 2KTMk1KhKA4Wk3TsdHujsAGfUmLDKkekXZ25LC+VMRId6nrrQ9ySFoSLqSpd1Qznu4qH S5LZ/itEEmuHiwET3rx/YNcyzERlTabftRD3Xl+LtG/fwE0DWiD/kISvlGWrYrujcW+C GzSg== 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 dn14si21593861ejc.414.2020.06.26.06.53.20; Fri, 26 Jun 2020 06:53:43 -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 S1728991AbgFZNwi (ORCPT + 99 others); Fri, 26 Jun 2020 09:52:38 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:59323 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728955AbgFZNwg (ORCPT ); Fri, 26 Jun 2020 09:52:36 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07425;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0U0lxLZx_1593179552; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U0lxLZx_1593179552) by smtp.aliyun-inc.com(127.0.0.1); Fri, 26 Jun 2020 21:52:32 +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 4/4] mm/mremap: start addresses are properly aligned Date: Fri, 26 Jun 2020 21:52:16 +0800 Message-Id: <20200626135216.24314-5-richard.weiyang@linux.alibaba.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20200626135216.24314-1-richard.weiyang@linux.alibaba.com> References: <20200626135216.24314-1-richard.weiyang@linux.alibaba.com> 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 After previous cleanup, extent is the minimal step for both source and destination. This means when extent is HPAGE_PMD_SIZE or PMD_SIZE, old_addr and new_addr are properly aligned too. Since these two functions are only invoked in move_page_tables, it is safe to remove the check now. Signed-off-by: Wei Yang Tested-by: Dmitry Osipenko --- mm/huge_memory.c | 3 --- mm/mremap.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 1e580fdad4d0..462a7dbd6350 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1729,9 +1729,6 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, struct mm_struct *mm = vma->vm_mm; bool force_flush = false; - if ((old_addr & ~HPAGE_PMD_MASK) || (new_addr & ~HPAGE_PMD_MASK)) - return false; - /* * The destination pmd shouldn't be established, free_pgtables() * should have release it. diff --git a/mm/mremap.c b/mm/mremap.c index a30b3e86cc99..f5f17d050617 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -199,9 +199,6 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, struct mm_struct *mm = vma->vm_mm; pmd_t pmd; - if ((old_addr & ~PMD_MASK) || (new_addr & ~PMD_MASK)) - return false; - /* * The destination pmd shouldn't be established, free_pgtables() * should have release it. -- 2.20.1 (Apple Git-117)