Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4256695rwb; Mon, 31 Jul 2023 04:18:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFH6Xz25csDZov/NIM88C/9Ovs3/YhlW+3+j895gj3JX5TKcSvI1omBTcH9NZ6K0VbfR5V X-Received: by 2002:a50:fc16:0:b0:522:5570:69be with SMTP id i22-20020a50fc16000000b00522557069bemr8124186edr.19.1690802321784; Mon, 31 Jul 2023 04:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690802321; cv=none; d=google.com; s=arc-20160816; b=E5Kdc7T20ELMOI7GEg9aMNnQbfjxFvt3httGzrupuSqsuJ4ZcqAcx7IYNXT2joidzl IFcPhVjcw5ZJYQLN+ElS7ODpMhk5l479Tn99pAlxGSNHeLJikVBeFkSiar5fz9cL3goX PQlyA5c98h1NoqHY7kf9rB+FPUwlLLFaRw8ZiadHgkBqXV1xgr2SigEHbyi8SEhRvxhJ 7VRXbMJjX5e+UjVTIvmutmsNTwFCQUFvu4B2IidoUwGQdqfd0V/RJ3FcheTcQohGRGGP LgdBs9TduiZyMSwVO2nsTXFZo+QnjdaWTt70lqW4EiPtzq5l5bjHYbIx4XBgy5QNMnmn 4KAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4vGKdw/o2lA0qWxLxkiW3KO7yrQPrwrqbRKwVE1vX0w=; fh=jS2OrAe9hfUKIH7L5cnOGJn9Vwrk2oAyc0ppPdUTZA4=; b=MjfBSEIihKELDAmoEF/ttlQn6QuZq7k6HS5Z/Ei+7I6eMPr2MXUs9LF2uFbs5OC03Z fw4NpKkJL7i7ie/6n3qqMnNg+haDu4+hYSGQ7tc2UhoY9m+j+936u/pmIzQr/ewqNjSL 1BKZmehQ4LLhl3UNVudNuvCO+OLXhINe9qwfmuxW5J+asMJHfWewcK+vhr5cbH+8L5PJ PJbC0Zn7mYWYMXLsxx2n6KnUy4wkC8f3EgDg98aKzOjGEfHFluaebciaKstcfvmXmmuV 5wN4VyK940ZOz0CItN9hkbnUklR9naJNwnCyitqra+SB1e0dsovAKldxPU9FNrDWPOMk +UkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h25-20020aa7c619000000b005222c082b54si6344324edq.437.2023.07.31.04.18.17; Mon, 31 Jul 2023 04:18:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbjGaLFk (ORCPT + 99 others); Mon, 31 Jul 2023 07:05:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbjGaLFi (ORCPT ); Mon, 31 Jul 2023 07:05:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E3A1AC for ; Mon, 31 Jul 2023 04:05:37 -0700 (PDT) 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 476DC6100F for ; 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230731074829.79309-3-wangkefeng.wang@huawei.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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