Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4432098rwb; Mon, 31 Jul 2023 06:55:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlHXkMe6PxrKj1qwZKYNCjXOeQ8oJbJ/ZMHfUoCHMw+HVYEP/zvH3niOBCui7VGb0yPuQKVq X-Received: by 2002:a05:6402:180f:b0:522:ae79:3ee6 with SMTP id g15-20020a056402180f00b00522ae793ee6mr27099edy.10.1690811710477; Mon, 31 Jul 2023 06:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690811710; cv=none; d=google.com; s=arc-20160816; b=yFUqU/RXTl+REtPR+WUqjA8a2wzt5AMlvzwVu77bEL/Ia0ouyk7B3mKOhJ08RHc1Bu C2sXqWGccg1VDpRxK2CdN8IL/l0SlJquAgso94TDfZqKLaXo95k7be+wsgf6/0aeAIWo uye8JXNmvjbNd/FQp5TFEOoRCzm/pr22VlXkW4GLRyUkdjQnlv0zQlk3rF9C2kB6GWWY Y+P7nHidkMfPtJE2P+6GLpA1INOtxMRj3DFOSPkJnM2l7arZX5iDsQjg92pGLeIEKb4e 6YmoKilTUfZM27v7q2xbZiRauOSLvsSNfO22Bjeu5KLfSTuzevuVmGYPP4mv8GV9UQIL MZgg== 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=xsPA6iTy+JJw12Fz4MBnlcETXUE2CsiLOVu0L+PoZ1U=; fh=jS2OrAe9hfUKIH7L5cnOGJn9Vwrk2oAyc0ppPdUTZA4=; b=bAKAr2i8Q9NeG7KfFqRDGRUAw3PxHFF5nYJsKJ7LJ5CAmemmHPzDmv3eV2jcGz+2s6 9+rszufamaQJ5gODfduA4CcFfa/qs5u5Td5SQiw683eFVY88Y/7acyUKElgglbPI5gci Qsyc3X8pY1UAWUF3eCVXNv+qeRoXKxXBbPe3LMQpGP6YAEPRpiONAgVnKxTRcAMkSjl7 KeUxEIuDHiyr9EO607pdA54lUwDngCIN14VykyEB8qVmzCohbo2ayxx1Kre5mAJo/cYn mss2lp5qcwjzpl2+RI1CRZz8N9xjjiVL5oivN1E4TNjtMDmuD+tUKRRb+HwBFKXmXXh/ OWzg== 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 n3-20020aa7c683000000b0051e1616f284si6879599edq.31.2023.07.31.06.54.44; Mon, 31 Jul 2023 06:55:10 -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 S231154AbjGaNSa (ORCPT + 99 others); Mon, 31 Jul 2023 09:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjGaNS3 (ORCPT ); Mon, 31 Jul 2023 09:18:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC51110DF for ; Mon, 31 Jul 2023 06:18:28 -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 2A1706113C for ; Mon, 31 Jul 2023 13:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7D57C433C8; Mon, 31 Jul 2023 13:18:18 +0000 (UTC) Date: Mon, 31 Jul 2023 14:18:12 +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 4/4] arm64: tlb: set huge page size to stride for hugepage Message-ID: References: <20230731074829.79309-1-wangkefeng.wang@huawei.com> <20230731074829.79309-5-wangkefeng.wang@huawei.com> <70e81ce8-a27a-325f-68d1-836532ed2ba0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70e81ce8-a27a-325f-68d1-836532ed2ba0@huawei.com> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 07:27:14PM +0800, Kefeng Wang wrote: > On 2023/7/31 19:11, Catalin Marinas wrote: > > On Mon, Jul 31, 2023 at 03:48:29PM +0800, Kefeng Wang wrote: > > > +/* > > > + * We cannot use leaf-only invalidation here, since we may be invalidating > > > + * table entries as part of collapsing hugepages or moving page tables. > > > + * Set the tlb_level to 0 because we can not get enough information here. > > > + */ > > > +#define flush_tlb_range(vma, start, end) \ > > > + __flush_tlb_range(vma, start, end, \ > > > + ((vma)->vm_flags & VM_HUGETLB) \ > > > + ? huge_page_size(hstate_vma(vma)) \ > > > + : PAGE_SIZE, false, 0) > > > > This won't work if we use the contiguous PTE to get 64K hugetlb pages on > > a 4K base page configuration. The 16 base pages in the range would have > > to be invalidated individually (the contig PTE bit is just a hint, the > > hardware may or may not take it into account). > > Got it, the contig huge page is depended on hardware implementation, > but for normal hugepage(2M/1G), we could use this, right? Right. Only the pmd/pud cases. -- Catalin