From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 872DC1A0341 for ; Fri, 26 Feb 2016 11:27:33 +1100 (AEDT) Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Feb 2016 10:27:32 +1000 Received: from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 31EE02BB0045 for ; Fri, 26 Feb 2016 11:27:25 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1Q0RGh117760428 for ; Fri, 26 Feb 2016 11:27:25 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1Q0Qqk2019139 for ; Fri, 26 Feb 2016 11:26:52 +1100 From: Gavin Shan To: linuxppc-dev@lists.ozlabs.org Cc: mpe@ellerman.id.au, Gavin Shan Subject: [PATCH 1/2] powerpc/mm: Remove duplicated check in do_page_fault() Date: Fri, 26 Feb 2016 11:26:25 +1100 Message-Id: <1456446386-28619-1-git-send-email-gwshan@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , When the page fault happened in user space, we need check it's caused by stack frame pointer update instruction and update local variable @flag with FAULT_FLAG_USER. Currently, the code has two separate check for the same condition. That's unnecessary. This removes one of the duplicated check. No functinal changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/mm/fault.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index a67c6d7..935f386 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -294,11 +294,10 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, * can result in fault, which will cause a deadlock when called with * mmap_sem held */ - if (user_mode(regs)) - store_update_sp = store_updates_sp(regs); - - if (user_mode(regs)) + if (user_mode(regs)) { flags |= FAULT_FLAG_USER; + store_update_sp = store_updates_sp(regs); + } /* When running in the kernel we expect faults to occur only to * addresses in user space. All other faults represent errors in the -- 2.1.0