From patchwork Tue Jul 25 21:31:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 9863889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 17627600F5 for ; Tue, 25 Jul 2017 21:32:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0286A286F3 for ; Tue, 25 Jul 2017 21:32:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB5F12870C; Tue, 25 Jul 2017 21:32:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C3F82870E for ; Tue, 25 Jul 2017 21:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751110AbdGYVbn (ORCPT ); Tue, 25 Jul 2017 17:31:43 -0400 Received: from belmont80srvr.owm.bell.net ([184.150.200.80]:49524 "EHLO mtlfep02.bell.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750857AbdGYVbm (ORCPT ); Tue, 25 Jul 2017 17:31:42 -0400 Received: from bell.net mtlfep02 184.150.200.30 by mtlfep02.bell.net with ESMTP id <20170725213141.NDMT19115.mtlfep02.bell.net@mtlspm02.bell.net> for ; Tue, 25 Jul 2017 17:31:41 -0400 Received: from [192.168.2.25] (really [70.31.74.123]) by mtlspm02.bell.net with ESMTP id <20170725213141.JYQW14758.mtlspm02.bell.net@[192.168.2.25]>; Tue, 25 Jul 2017 17:31:41 -0400 From: John David Anglin Mime-Version: 1.0 (Apple Message framework v1085) Date: Tue, 25 Jul 2017 17:31:41 -0400 Subject: [PATCH] parisc: Optimize switch_mm Cc: Helge Deller , James Bottomley To: Parisc List Message-Id: <16F63B59-7A36-48F0-A5C7-670CA2ED9DED@bell.net> X-Mailer: Apple Mail (2.1085) X-Cloudmark-Analysis: v=2.2 cv=LoB98jVc c=1 sm=0 tr=0 a=CP4CeFkTTpGPfaygvaSIJA==:17 a=G3gG6ho9WtcA:10 a=FBHGMhGWAAAA:8 a=Nmc4uQoqCnoAKsTWhTcA:9 a=CjuIK1q_8ugA:10 a=ATlVsGG5QSsA:10 a=1LP3YPDXPbz0WqG8weUA:9 a=Ld372NDzu18A:10 a=CTwWI_8SlGQyalyz8_QA:9 a=9gvnlMMaQFpL9xblJ6ne:22 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We only need to switch contexts when prev != next, and we don't need to disable interrupts to do the check. Signed-off-by: John David Anglin --- John David Anglin dave.anglin@bell.net diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h index a81226257878..b1dc6e3f0dd0 100644 --- a/arch/parisc/include/asm/mmu_context.h +++ b/arch/parisc/include/asm/mmu_context.h @@ -49,26 +49,19 @@ static inline void load_context(mm_context_t context) mtctl(__space_to_prot(context), 8); } -static inline void switch_mm_irqs_off(struct mm_struct *prev, +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) { + unsigned long flags; + if (prev != next) { + local_irq_save(flags); mtctl(__pa(next->pgd), 25); load_context(next->context); + local_irq_restore(flags); } } -static inline void switch_mm(struct mm_struct *prev, - struct mm_struct *next, struct task_struct *tsk) -{ - unsigned long flags; - - local_irq_save(flags); - switch_mm_irqs_off(prev, next, tsk); - local_irq_restore(flags); -} -#define switch_mm_irqs_off switch_mm_irqs_off - #define deactivate_mm(tsk,mm) do { } while (0) static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)