Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp4672884rwp; Sun, 16 Jul 2023 08:14:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlGzz5q/XNU4JenpyQ0H6hcUCXlJTkASb9opeUlnnp0howMjGEZ1nQYu9ZGSiIAet8fq2uW+ X-Received: by 2002:a17:902:db06:b0:1b8:6dea:e270 with SMTP id m6-20020a170902db0600b001b86deae270mr10799359plx.16.1689520439925; Sun, 16 Jul 2023 08:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689520439; cv=none; d=google.com; s=arc-20160816; b=juu15rF1MU7lFN3eSu/lLkTF5fmeC98nA+m0HzHLMfOX4nERh4RlEQg8Xu2uSxziv6 jeWdUACXG0NCPgM3MXIwdKTBmQXx/0F/EHarG7JfwAdsKARSREWyg7XhqvrTQpdG7kw6 vJNWU84Ly22VI8pKlltRGmj3VX95tyTB3y/tjMyhB2hcurRHMrVeKzjxUc6+oxxXnTGh Fa1HUFJiavf9q43uXnSAZq1dxHO9D1GjoWmVjo/iaF3q9HA1Sf5SHpeMF8XAVrN2SJKQ Sj8p/x59tYd9gZCzYRoB4F8SXTao/ALF3MvjP5jrigdBzvRkCDviHx9DP0WRmtcHZgtV ynqw== 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=AgoofMymdZyOdUtsAe1UsW5CIzZPJ6bSdSbmS7A7yoI=; fh=p3gIyRhXTPYAw2ftDC0TPLmHC8aURM0UFqYsBdFsu9c=; b=yBuVxEJsFsaQoeVrsPXnM10mszmEjMtYNGU9qA7HSV7lWvu55UatR3X7dX571zh/9L RFZOo69JGy7Q9Sm0GOLe1ilw35Ed4L/DUbKTrQl2Iv0mafUho9PDY+cxnWvQ6CeazIIK PC+oprTJ4Go0DQDQTirkUkjn8su/bVXSZcq0z0Cwv6t6MH2l2TqkGvC/a4ZYx3Ntj1vV tiytvnzWpl5Ojm5qm6ow3mWw4O6C+dQ8hpEe2HogP+F/5f8yNxVPsZAEM2sqsogQuGu+ mKuY0mCr5vxYWySaUxRvhWrYJmzyJMYPzX1vNMt0qShmzaH17lhPICyd9lF4ftTSaqfU nudQ== 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 c19-20020a170902f31300b001b8c4168e20si2733323ple.58.2023.07.16.08.13.45; Sun, 16 Jul 2023 08:13:59 -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 S230095AbjGPPMD (ORCPT + 99 others); Sun, 16 Jul 2023 11:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbjGPPMC (ORCPT ); Sun, 16 Jul 2023 11:12:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51ACB1B7; Sun, 16 Jul 2023 08:12:01 -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 E2D6260D2E; Sun, 16 Jul 2023 15:12:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FFB8C433C9; Sun, 16 Jul 2023 15:11:58 +0000 (UTC) Date: Sun, 16 Jul 2023 08:11:56 -0700 From: Catalin Marinas To: Yicong Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, mark.rutland@arm.com, ryan.roberts@arm.com, will@kernel.org, anshuman.khandual@arm.com, linux-doc@vger.kernel.org, corbet@lwn.net, peterz@infradead.org, arnd@arndb.de, punit.agrawal@bytedance.com, linux-kernel@vger.kernel.org, darren@os.amperecomputing.com, yangyicong@hisilicon.com, huzhanyuan@oppo.com, lipeifeng@oppo.com, zhangshiming@oppo.com, guojian@oppo.com, realmz6@gmail.com, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, Barry Song <21cnbao@gmail.com>, wangkefeng.wang@huawei.com, xhao@linux.alibaba.com, prime.zeng@hisilicon.com, Jonathan.Cameron@huawei.com, Barry Song , Nadav Amit , Mel Gorman Subject: Re: [PATCH v10 4/4] arm64: support batched/deferred tlb shootdown during page reclamation/migration Message-ID: References: <20230710083914.18336-1-yangyicong@huawei.com> <20230710083914.18336-5-yangyicong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230710083914.18336-5-yangyicong@huawei.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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 10, 2023 at 04:39:14PM +0800, Yicong Yang wrote: > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 7856c3a3e35a..f0ce8208c57f 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -96,6 +96,7 @@ config ARM64 > select ARCH_SUPPORTS_NUMA_BALANCING > select ARCH_SUPPORTS_PAGE_TABLE_CHECK > select ARCH_SUPPORTS_PER_VMA_LOCK > + select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if EXPERT I don't want EXPERT to turn on a feature that's not selectable by the user. This would lead to different performance behaviour based on EXPERT. Just select it unconditionally. > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > index 412a3b9a3c25..4bb9cec62e26 100644 > --- a/arch/arm64/include/asm/tlbflush.h > +++ b/arch/arm64/include/asm/tlbflush.h > @@ -254,17 +254,23 @@ static inline void flush_tlb_mm(struct mm_struct *mm) > dsb(ish); > } > > -static inline void flush_tlb_page_nosync(struct vm_area_struct *vma, > - unsigned long uaddr) > +static inline void __flush_tlb_page_nosync(struct mm_struct *mm, > + unsigned long uaddr) > { > unsigned long addr; > > dsb(ishst); > - addr = __TLBI_VADDR(uaddr, ASID(vma->vm_mm)); > + addr = __TLBI_VADDR(uaddr, ASID(mm)); > __tlbi(vale1is, addr); > __tlbi_user(vale1is, addr); > } > > +static inline void flush_tlb_page_nosync(struct vm_area_struct *vma, > + unsigned long uaddr) > +{ > + return __flush_tlb_page_nosync(vma->vm_mm, uaddr); > +} > + > static inline void flush_tlb_page(struct vm_area_struct *vma, > unsigned long uaddr) > { > @@ -272,6 +278,42 @@ static inline void flush_tlb_page(struct vm_area_struct *vma, > dsb(ish); > } > > +#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH If it's selected unconditionally, we won't need this #ifdef here. > + > +static inline bool arch_tlbbatch_should_defer(struct mm_struct *mm) > +{ > +#ifdef CONFIG_ARM64_WORKAROUND_REPEAT_TLBI > + /* > + * TLB flush deferral is not required on systems, which are affected with "affected by" and drop the comma before "which". -- Catalin