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 D5039C433EF for ; Thu, 7 Jul 2022 13:50:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A8DB6B0072; Thu, 7 Jul 2022 09:50:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 158BD6B0073; Thu, 7 Jul 2022 09:50:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0479C6B0074; Thu, 7 Jul 2022 09:50:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E97566B0072 for ; Thu, 7 Jul 2022 09:50:26 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BC5A8F43 for ; Thu, 7 Jul 2022 13:50:26 +0000 (UTC) X-FDA: 79660438452.12.67DFA45 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf02.hostedemail.com (Postfix) with ESMTP id BFE0680005 for ; Thu, 7 Jul 2022 13:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=cHtPqf0EZi6Rmr2HnZOjOrCXsqzXZi//SFvwSsuDJxg=; b=HSq2FS0mqQIs+Q8D5ZU9Sfzo5y Y0+meYy1GAId0uW0Qfe0IafRM4UVJsLS12rsfb8JHVlmiYw8PqYYQw/2exCuPuB1wZ+GQyfE9sFZ8 aUP1HqEnFahXi8DUojJjffY/uTGSyVPpFkwA47f+e+PP2Lxaux4gckd9gjazwICe/Jjbqh02KNJNN pEOGZliIuhyqCq34U94wK2EhcDpRwmz1wYiJvBPMc71rAmin8S0ELfj90xgEhFViQ+AsuctRpOXpw mxpY5/TAIG9fWOkn3ruzr2kEFVr57RPPkNJWkk9zj+fb8R/7G4i4POj5aDbwEHxq5VhMdWVutO/Ut 1k7+rSkw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9Rsw-001IU7-Nf; Thu, 07 Jul 2022 13:49:43 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 908C3300872; Thu, 7 Jul 2022 15:49:34 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5083920CA4D3D; Thu, 7 Jul 2022 15:49:34 +0200 (CEST) Date: Thu, 7 Jul 2022 15:49:34 +0200 From: Peter Zijlstra To: Barry Song <21cnbao@gmail.com> Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, catalin.marinas@arm.com, will@kernel.org, linux-doc@vger.kernel.org, corbet@lwn.net, arnd@arndb.de, 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, Barry Song , Nadav Amit , Mel Gorman Subject: Re: [PATCH 4/4] arm64: support batched/deferred tlb shootdown during page reclamation Message-ID: References: <20220707125242.425242-1-21cnbao@gmail.com> <20220707125242.425242-5-21cnbao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220707125242.425242-5-21cnbao@gmail.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657201825; a=rsa-sha256; cv=none; b=SPBaM8XYbkmG6hP87kzfqg7VhRnDtCbGo0dzw/x356cREbYRTyxkYaKNb8OrGMznVaApon zZHywANn9t7OkH6s3AlCLRb6r6gYtbMFxwsd+GsqQVBVuD2MJmhBQqGd2ZnSclddzrCKbl q8tGX6olkKWNPFNyLn5kmqmq99aPdJ0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=HSq2FS0m; dmarc=none; spf=none (imf02.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657201825; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cHtPqf0EZi6Rmr2HnZOjOrCXsqzXZi//SFvwSsuDJxg=; b=JjI77CHqFe5mvW/T7YbBtUFoCuvJzoUBIN2m8qpifVqGb7E6IMs9q7XmlFyeTTxvmGoQcT KACZPx5JkEXvWHSb4DSs2zHkWRdEHCC6/bv7YhzqWEl8yByHXqRq5KPScDNDo+QFpOdroN RqutryizvfEHj6oaK8679aSCegXCnHg= X-Rspamd-Server: rspam04 X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=HSq2FS0m; dmarc=none; spf=none (imf02.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org X-Stat-Signature: bj69is59m3zaq5yb5ucikx9bdw5z9yar X-Rspamd-Queue-Id: BFE0680005 X-HE-Tag: 1657201824-448838 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 Fri, Jul 08, 2022 at 12:52:42AM +1200, Barry Song wrote: > diff --git a/arch/arm64/include/asm/tlbbatch.h b/arch/arm64/include/asm/tlbbatch.h > new file mode 100644 > index 000000000000..fedb0b87b8db > --- /dev/null > +++ b/arch/arm64/include/asm/tlbbatch.h > @@ -0,0 +1,12 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef _ARCH_ARM64_TLBBATCH_H > +#define _ARCH_ARM64_TLBBATCH_H > + > +struct arch_tlbflush_unmap_batch { > + /* > + * For arm64, HW can do tlb shootdown, so we don't > + * need to record cpumask for sending IPI > + */ > +}; > + > +#endif /* _ARCH_ARM64_TLBBATCH_H */ > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > index 412a3b9a3c25..b3ed163267ca 100644 > --- a/arch/arm64/include/asm/tlbflush.h > +++ b/arch/arm64/include/asm/tlbflush.h > @@ -272,6 +272,19 @@ static inline void flush_tlb_page(struct vm_area_struct *vma, > dsb(ish); > } > > +static inline void arch_tlbbatch_add_mm(struct arch_tlbflush_unmap_batch *batch, > + struct mm_struct *mm, > + struct vm_area_struct *vma, > + unsigned long uaddr) > +{ > + flush_tlb_page_nosync(vma, uaddr); > +} You're passing that vma along just to get the mm, that's quite silly and trivially fixed. diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h index 412a3b9a3c25..87505ecce1f0 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) {