From patchwork Tue Dec 17 07:17:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 11296939 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5C4C14E3 for ; Tue, 17 Dec 2019 07:17:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A282520733 for ; Tue, 17 Dec 2019 07:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A282520733 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EE1F28E0041; Tue, 17 Dec 2019 02:17:41 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E92F88E0040; Tue, 17 Dec 2019 02:17:41 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA9458E0041; Tue, 17 Dec 2019 02:17:41 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id C396F8E0040 for ; Tue, 17 Dec 2019 02:17:41 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 831F74403 for ; Tue, 17 Dec 2019 07:17:41 +0000 (UTC) X-FDA: 76273778322.25.quilt19_8e5608705825 X-Spam-Summary: 2,0,0,f1ea82849e8dcd44,d41d8cd98f00b204,aneesh.kumar@linux.ibm.com,:akpm@linux-foundation.org:npiggin@gmail.com:mpe@ellerman.id.au:peterz@infradead.org::linux-kernel@vger.kernel.org:linuxppc-dev@lists.ozlabs.org:aneesh.kumar@linux.ibm.com,RULES_HIT:41:355:379:541:800:960:966:968:973:988:989:1260:1261:1311:1314:1345:1359:1431:1437:1515:1534:1541:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:4321:4385:5007:6119:6120:6261:7903:8634:10004:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:12986:13069:13161:13229:13311:13357:13894:14096:14181:14384:14721:21080:21451:21627:30054,0,RBL:148.163.156.1:@linux.ibm.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: quilt19_8e5608705825 X-Filterd-Recvd-Size: 5000 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Dec 2019 07:17:40 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBH7HT88083014; Tue, 17 Dec 2019 02:17:32 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2wxpvwdx17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2019 02:17:31 -0500 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id xBH7HVkO083309; Tue, 17 Dec 2019 02:17:31 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2wxpvwdx02-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2019 02:17:31 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id xBH7Ev8j003103; Tue, 17 Dec 2019 07:17:29 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma03dal.us.ibm.com with ESMTP id 2wvqc6gnqf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2019 07:17:29 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xBH7HSIX50266446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Dec 2019 07:17:28 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D27B6E04C; Tue, 17 Dec 2019 07:17:28 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CC7E6E050; Tue, 17 Dec 2019 07:17:25 +0000 (GMT) Received: from skywalker.in.ibm.com (unknown [9.204.201.20]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 17 Dec 2019 07:17:25 +0000 (GMT) From: "Aneesh Kumar K.V" To: akpm@linux-foundation.org, npiggin@gmail.com, mpe@ellerman.id.au, peterz@infradead.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" Subject: [RFC PATCH 2/2] mm/mmu_gather: Avoid multiple page walk cache flush Date: Tue, 17 Dec 2019 12:47:13 +0530 Message-Id: <20191217071713.93399-2-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191217071713.93399-1-aneesh.kumar@linux.ibm.com> References: <20191217071713.93399-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-17_01:2019-12-16,2019-12-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=2 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912170063 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 tlb_finish_mmu() kernel does a tlb flush before mmu gather table invalidate. The mmu gather table invalidate depending on kernel config also does another TLBI. Avoid the later on tlb_finish_mmu(). Signed-off-by: Aneesh Kumar K.V --- mm/mmu_gather.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c index 7c1b8f67af7b..7e2bd43b9084 100644 --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -143,17 +143,23 @@ static void tlb_remove_table_rcu(struct rcu_head *head) free_page((unsigned long)batch); } -static void tlb_table_flush(struct mmu_gather *tlb) +static void __tlb_table_flush(struct mmu_gather *tlb, bool table_inval) { struct mmu_table_batch **batch = &tlb->batch; if (*batch) { - tlb_table_invalidate(tlb); + if (table_inval) + tlb_table_invalidate(tlb); call_rcu(&(*batch)->rcu, tlb_remove_table_rcu); *batch = NULL; } } +static void tlb_table_flush(struct mmu_gather *tlb) +{ + __tlb_table_flush(tlb, true); +} + void tlb_remove_table(struct mmu_gather *tlb, void *table) { struct mmu_table_batch **batch = &tlb->batch; @@ -178,7 +184,7 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table) static void tlb_flush_mmu_free(struct mmu_gather *tlb) { #ifdef CONFIG_HAVE_RCU_TABLE_FREE - tlb_table_flush(tlb); + __tlb_table_flush(tlb, false); #endif #ifndef CONFIG_HAVE_MMU_GATHER_NO_GATHER tlb_batch_pages_flush(tlb);