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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAD46EB64DC for ; Mon, 17 Jul 2023 12:26:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AB7F6B0072; Mon, 17 Jul 2023 08:26:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35B9E8D0002; Mon, 17 Jul 2023 08:26:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 223448D0001; Mon, 17 Jul 2023 08:26:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 136346B0072 for ; Mon, 17 Jul 2023 08:26:26 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CAA771202F9 for ; Mon, 17 Jul 2023 12:26:25 +0000 (UTC) X-FDA: 81021026730.14.B401BA2 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf23.hostedemail.com (Postfix) with ESMTP id B4236140010 for ; Mon, 17 Jul 2023 12:26:20 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.hostedemail.com: domain of yangyicong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yangyicong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689596783; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fofri0A6r9Puu769hWdNEwqLNzNlwk+CiO2hWzQ9xe8=; b=hoR+PHm37yBRsmYDwzvcKpPmmJ4MxuKprUbZHEbf8rpYVo3XPclGqhgr/lu1QAvocnXBgX XkIYtkEfTSWufMeD7Ggq3/UuJ/M05vtkHAjyxUittbakKFbgra5MdP1WiViZSyFegloKdh mvfnyddSIsy4V2+toC4zmxg0++HtjjI= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.hostedemail.com: domain of yangyicong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yangyicong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689596783; a=rsa-sha256; cv=none; b=MqtdFgHLnnL555DTA5F5sR0eaIv/hGW0Y2S0o2+zjICa8GWCX+a9+HbMifNDfK/XpVNzQX aZ9I69mjnVTkR5qKkPqZK0P/IJ3xmIQYSIMkeS9RQxnCEgMoLUDdWG2hceoCf729ZSGNy5 zfjPQy5mnr/jIrC3uuvAgc1IYTwl0Nc= Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R4Lrp2BrKz18LY9; Mon, 17 Jul 2023 20:25:30 +0800 (CST) Received: from [10.67.102.169] (10.67.102.169) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 17 Jul 2023 20:26:11 +0800 CC: , , , , , , , , , , , , , , , , , , , , , , , , , , Barry Song <21cnbao@gmail.com>, , , , , Barry Song , Nadav Amit , Mel Gorman Subject: Re: [PATCH v10 4/4] arm64: support batched/deferred tlb shootdown during page reclamation/migration To: Catalin Marinas References: <20230710083914.18336-1-yangyicong@huawei.com> <20230710083914.18336-5-yangyicong@huawei.com> From: Yicong Yang Message-ID: <9438aa19-8eb5-a36a-c4a0-6c8333665637@huawei.com> Date: Mon, 17 Jul 2023 20:26:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.169] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B4236140010 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 5ca7kmzxxqxuhcfmd9kx8tpbsdeahc1e X-HE-Tag: 1689596780-605250 X-HE-Meta: U2FsdGVkX19YJr8aTm+l6K++HjbBtRlvRGqE3Nq1GWrrUYO29jssv/t3SXwrtF37yxYCs0zdaaOJXyqnE/pDgxNcoWOo9tYTCT7DZH/3LWkKo0IiNHzaN6PsV5FymWhBJGp1znWY7Lx6Hlv2j45BZd97dW/BZImoFof8AbLzWxaFfNpi0vEKiGvdPB3zmYsE6nuI0zDbzbdprZOMBaTt/SxxU6d08pw06h3ZP7JaCXfgoV3aSrw9LcJGeCEc7jzYl6xx2gF9Oo9zWxxD4b4eVMeOvduje5kQKBaukD+hyWNpYOUVGKMclgDWhtU+74w8Pq8wSoBHxtOkdQ8j/tjOQYRufZyvHjFiLtJZGtbFT3Ll6M0M9b7Jj9WTJUsK8rkxQQLQDtNLB7yBKJGxSFQO/2XGyb89xAgi7GQ7L0bLvIpTmGPwsrH2NdkLieutpUp6BcHmfCMIAj6MKX9iMavGjFbdoZgmMrhEDyD5obNBa2g0dZXR77/X7SGGndNPyJjM/NWlBqhXvS3bR0Q1NowdtpUeROTtnaaODFBpR4qRCmYivCRKioy9TL3qA4QGWlfUjWCdzs8Ld5kTI+ur3xzRmNC9Rvz+gkxyUwuNYcpBIpll5jM9PZcBthyZEvNGEwcvalFEZHGcGKdunbYt/YTL43/UevkFht2NwwAP41igctYtm5fwNvlnautZ3sWJVG2uz6cASDycjXACA3s4PRMEB4Ku9zyEB+eO01wb7Rt+c2wyUl7d0N3FehYEMe3guBnJF8chP8OOwWk+uFFcWI9j5ifa9qkQvx9gLH/ecLryXRVie9m5iT8LxKidL5AnDN8bfnFQqjtE5P+bBJDDzn2jTz4F0/0N/tp1cFOE++M3/ENtIX2b0yEsc5j5qEMTQGguRjcvnrIAkPNy8GB07Wp8h79x9uPVA4dMvBpN9jPPTW9VJZ+69U8/KpwUQZr4cLu0b10ShcesTbJPW4S26WB id1cvUGE 3D+j/jLYxTsykvjDFARnWCfj2lWDLRMs4vlJFD8WM3flFgWEL3tWtIHS9yIL8rqF5SWpm5UBi1kqJ/GYYhs60VsUho2+FSewM73bAwzgiCc0ztjrnenFfz5YSX5atKmrRjIA9 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2023/7/16 23:11, Catalin Marinas wrote: > 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. Got it. will drop it and address the comment below. Thanks. > >> 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". >