From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D838AC41513 for ; Mon, 31 Jul 2023 11:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1IEv9WHKv7U3SUW/a4SSbBGhPc9h+ttDBIYPtezzwAI=; b=fh430coNfllO8l 1pqgIsJj4CJWiEBPRIkUDLY3JWxHvgcT1CtJCnX8XvlB4JEV0c1xsynD6gx29cIZxLfUeZa6YiWDA HHKpqCAtIOYl9Nt8x1zmOq8JNFtG3IHP/YA0Nw4hBJXgEUd75uVSnWe/ieuM5ODOzigSWcN2MhMct af0Cyb20GK2B3VeH++FsT4rBijurNzY07sR30UQgJPwkhyoLZ+22IiB+uzL0wGKQ5dhktu9YTnRyb Xea1+UF400diDIQE+BVjDx8ht/XiEY/Qd0TPNWr/qE9sWgmE10gV5ATtLraU9ekBDCY+88pkc9ULo v4IBpxd1wmxMAxW1zrDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQQie-00FIHg-3C; Mon, 31 Jul 2023 11:05:44 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQQiX-00FIFF-2Q for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2023 11:05:39 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B4666102E; Mon, 31 Jul 2023 11:05:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA7EC433C8; Mon, 31 Jul 2023 11:05:29 +0000 (UTC) Date: Mon, 31 Jul 2023 12:05:25 +0100 From: Catalin Marinas To: Kefeng Wang Cc: Andrew Morton , Will Deacon , Mike Kravetz , Muchun Song , Mina Almasry , kirill@shutemov.name, joel@joelfernandes.org, william.kucharski@oracle.com, kaleshsingh@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] mm: mremap: use flush_pmd_tlb_range() in move_normal_pmd() Message-ID: References: <20230731074829.79309-1-wangkefeng.wang@huawei.com> <20230731074829.79309-3-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230731074829.79309-3-wangkefeng.wang@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_040537_835931_CA08399A X-CRM114-Status: GOOD ( 19.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 31, 2023 at 03:48:27PM +0800, Kefeng Wang wrote: > Archs may need to do special things when flushing thp tlb, > so use the more applicable flush_pud_tlb_range() instead of > flush_tlb_range(). > > Fixes: 2c91bd4a4e2e ("mm: speed up mremap by 20x on large regions") > Signed-off-by: Kefeng Wang > --- > mm/mremap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/mremap.c b/mm/mremap.c > index 11e06e4ab33b..1883205fa22b 100644 > --- a/mm/mremap.c > +++ b/mm/mremap.c > @@ -284,7 +284,7 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, > VM_BUG_ON(!pmd_none(*new_pmd)); > > pmd_populate(mm, new_pmd, pmd_pgtable(pmd)); > - flush_tlb_range(vma, old_addr, old_addr + PMD_SIZE); > + flush_pmd_tlb_range(vma, old_addr, old_addr + PMD_SIZE); I don't think that's correct for arm64. The assumption in the flush_p*d_tlb_range() was that they are called only for block mappings at that p*d level (and we use FEAT_TTL on arm64 indicating that the leaf level is level 2 for pmd, 1 for pud). IIUC move_normal_pmd() is only called for table pmds which would have a leaf level of 3 (the pte). Same for the next patch doing the equivalent for the pud. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel